Take FREE!! Online Mettl Mock Test to Crack TechM and Other Companies Written Exams.
Get Off-Campus Placement Jobs Info !!!
TCS NQT Technical and Managerial Round Interview Questions

Program Discussion :: Basics

Home > Programs > Basics

10 / 265

Write a program using sizeof and strlen.



int main() 
    char str[50];
    printf("\nEnter a string: ");
    printf("\nSize of the string is: %d",sizeof(str));  //sizeof() operator gives the size in bytes.
    printf("\nLength of the string is: %d",strlen(str));    //strlen() function gives the length of the whole string.
    return 0;

Asked In :: Syntel Inc.

Post Your Answer Here:


Post Your Reply Here: