nitish.mohiputlall -4 Junior Poster in Training
here is the original codes that has been set in the question paper:
#include <stdio.h>
#define numitems 10
int main(int argc, char* argv[])
{
int data[numitems];
int i;
int *ptr;
for(ptr = data; ptr < &data[numitems]; ptr++)
*ptr = 0;
for (i=0;i<numitems;i++)
printf("data[%d]=%d\n", i, data[i]);
return 0;
}
HERE ARE MY MODIFICATION BUT STILL NOTHING IS BEING DISPLAYED:
    #include <stdio.h>
#define numitems 10
int main(int argc, char* argv[])
{
int data[numitems];
int i;
int *ptr;
for(ptr = data; ptr < &data[numitems]; (ptr=ptr+2)){
*ptr = 2;
}
for (i=0;i<numitems;i++)
{
printf("data[%d]=%d\n", i, data[i]);
}
return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.