SCHOOL OF CODE BUILDERS
Learn To CODE. Become A DEVELOPER.
Pages
HOME
DATA STRUCTURES
STRINGS
ARRAYS
MATRIX
BINARY TREES
LINKED LIST
STACK
QUEUE
SORTING
SEARCHING
C
PYTHON
PSEUDOCODE
CONTEST PROBLEMS
ALGORITHMS
PATTERNS
PHP
C PUZZLES
C INTERVIEW QUESTIONS
JAVA
C++
HASHING
RECURSION
BASIC C PROGRAMS
TCS-CODEVITA
FACEBOOK
CONTACT US
C program to print first letter of string
C program to print first letter of string
Output:
Enter the string to print its first character:
www.coderegister.co.in
The first character of the string www.coderegister.co.in is 'w'
Implementation:
#include
int main(void) { char str[1000]; printf("Enter the string to print its first character:\n"); scanf("%s",str); printf("The first character of the string %s is '%c'\n",str,str[0]); /* also the following printf statements can also be used to print the first character of the string */ /* The statements are: printf("%c",0[str]); printf("%c",*(str+0)); printf("%c",*(0+str)); printf("%c",*str); */ return 0; }
PREVIOUS
NEXT
HOME