edited by
789 views
0 votes
0 votes

edited by

1 Answer

1 votes
1 votes
#include <stdio.h>

int main(void) {
    char str[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8 ,9}; 
    char *ptr; 
    int i; 
    ptr = str; 
    for(i=0;i<=9;i++) {
        if (*ptr){
            printf("%c",*ptr);
            ptr++;
        }    
    }
    return 0;
}

After entering the loop (i=0) *ptr will give value 0. Hence if condition fails and will not print any value as well as ptr is non incremented.

similarly for i = 1,2,3,4,....9 

Nothing will be printed because if condition is not satisfied for any value of i.

D) None of these

edited by

Related questions

0 votes
0 votes
1 answer
1