Re: Pointers Problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Manoj tr wrote:
hai all

char **argv; char *line1="Good Morning";
char *line2="Good Evening";
how to copy line1 to the first index of argv and line2 to the second. ie argv[0], argv[1];
and how to retrive this line1 and line2



IMO, it's better not changing argv, if argv is the usual "main()" argv parameter.


If this isn't the case, argv shall have some memory allocated to it.

You can do, e.g. :

* char *argv[] = {"Good Morning", "Good Evening", NULL};

* char *argv[SOME_DIMENSION];
  char *line1="Good Morning";
  char *line2="Good Evening";
  argv[0] = line1;
  argv[1] = line2;

* char **argv;
  char *line1="Good Morning";
  char *line2="Good Evening";
  argv = (char **) malloc(SOME_DIMENSION * sizeof (*argv));
  argv[0] = line1;
  argv[1] = line2;

This is a small problem in the case of experts. So i request that dont avoid it. Please send the replay

Manoj


--
 ---------------------------------------------------------------
 Jose Marcio MARTINS DA CRUZ           Tel. :(33) 01.40.51.93.41
 Ecole des Mines de Paris              http://j-chkmail.ensmp.fr
 60, bd Saint Michel                http://www.ensmp.fr/~martins
 75272 - PARIS CEDEX 06      mailto:Jose-Marcio.Martins@xxxxxxxx

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux