Here is a program, I write it to output all the characters of a string one by one. But I also print the address of individual blocks of the array. The problem is addresses for all blocks are same. Why? Does someone know?
#include<stdio.h>
int main()
{
char enter[]="Kinsman";
char *ptr;
ptr=enter;
int i=0;
while(*ptr!='\0')
{
printf("%c%p\n",*ptr,&ptr);
ptr++;
for(i=0;i<=100000000;i++);
}
return 0;
}
for(i=0;i<=100000000;i++);?? why thisFOR I=1 TO 500: NEXT I. But this method - waiting in terms of cycles - has been outdated for about 20 years.i = 100000000;.. it is not reliable. Correct?sleep()orusleep()on Unix,Sleep()on WIndows.