Stopping at the null character

Wednesday, October 15, 2014
/* 1205.c: Stopping at the null character */
#include <stdio.h>

main()
{
    char array_ch[15] = {'C', ' ' ,
    'i', 's', ' ',
    'p', 'o', 'w', 'e', 'r',
    'f', 'u', 'l', '!', '\0'};
    int i;
    /* array_ch[i] in logical test */
    for (i=0; array_ch[i] != '\0'; i++)
    printf("%c", array_ch[i]);
    return 0;
}

Copyright @ 2015 Tron!

Labels

Blog Archive