Size of structure: Structure is a collection of elements. The size is equals to sum of sizes of individual elements. sizeof() function can be used to specify the size. We can find the size either …
Primitive types: Using primitive variables, we can store only 1 value at a time. To store more than one value, number of variables need to be declared. It is complex to work with number of …
void *memchr(const void *str, int c, size_t n) Searches for the first occurrence of the character c (an unsigned char) in the first n bytes of the string pointed to, by the argument str. int …
strcmp(): It is Pre-defined function in string.h header file. Check the input strings are having same content or not. IF equal, returns 0. If not equal, returns non zero. strcmp() function consider the case. Lower …
Reverse the string : This program reverses a string entered by the user. For example, if a user enters a string “reverse me” then on reversing the string will be “em esrever”. To reverse string …
Convert UPPER string into LOWER string : Above program without using library function:
strlen() : Find the length of string. Return +ve integer value (size_t) size_t is a datatype represents “unsigned” Prototype is size_t strlen(char s); Finding the length without using pre-defined function: Finding the length with user …
Reading string: “%s” can be used to read a string. “%s” will take the base address of memory block to read. To read a string(more than 1 character), loops are not required. Why we are …
Display strings with quotes: Output : It is ‘C-lang’ class Output : It’s a C class Output : I am attending “C – Online” class Output : She said, “It’s a good one” Note: Array …
String will be terminated when it reaches ‘\0’ character: Note : Strings can be processed with \0 character only. ASCII value as follows. Note : In the above program, printf() function stops printing string when …