#include<stdio.h> #include<string.h> int main (){ char str[6] ={'h','e','l','l','o','\0'}; printf("%s",str); //using strlen // strlen = string length printf("\nlength of string is %lu", strlen(str)); //using strcpy /*strcpy (s1 ,s2)= copy secound string in frist string*/ char str2[6]; strcpy(str2,str); printf("\n string1 copied in str2 = %s",str2); /* using of strncpy strncpy(s1,s2,length of string to be copied) = copies characters of a string s2 to another string s1 up to a speciafied length n */ char str3 [ 10 ] ; strncpy ( str3 , str , 4 ) ; printf ( "\n after strncpy str3 is %s " , str...
#include<stdio.h> int main(){ int n; printf("Enter the value of n \n"); scanf("%d", &n); for(int i=n; i ; i--){ printf("The value of i is %d\n", i); } return 0; }
Comments
Post a Comment