comp.lang.c.moderated
  Home FAQ Contact Sign in
comp.lang.c.moderated only
 
Advanced search
May 2008
motuwethfrsasuw
   1234 18
567891011 19
12131415161718 20
19202122232425 21
262728293031  22
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.c.moderated Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  To reallocate an array ?         


Author: erktek
Date: May 22, 2008 14:53

#include
#include
#include

int main(int argc, char* argv[])
{
int i;
int a[1];
int *p = NULL;

p = a;

p = (int *) realloc(p,3*sizeof(int));

p[0] = 1;
p[1] = 2;
p[2] = 3;

for (i=0; i < 3;i++)
printf("%%d\n",p[i]);

free(p);

return 0;
}
Show full article (0.65Kb)
6 Comments
  problem with file pointer while reading         


Author: raman kumar
Date: May 22, 2008 14:53

i want to read complete ascii file, i am reading it using file pointer
&
but problem is that , the file pointer is not coming to EOF , it's
just holding the last value
how can solve that problem

here is sample code

fp=fopen("inputfile","r");

while(fp!=EOF)// this is contineously looping , what is condition to
get out of loop at the EOF
{
fpscanf(fp,"%%s",str);
}
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
7 Comments