Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

%s and string pointer

#include<stdio.h>

int main()
{
    char str[6] = "Hello";
    int i;

    /*
     * str+0 will print "Hello"
     * str+1 will print "ello"
     * str+2 will print "llo"
     * str+3 will print "lo"
     * str+4 will print "o"
     */
    for(i = 0; str[i]; i++)
        printf("%s
",str+i);

    return 0;
}
Source by www.log2base2.com #
 
PREVIOUS NEXT
Tagged: #string #pointer
ADD COMMENT
Topic
Name
6+4 =