Given a string, find the first occurrence of a uppercase letter in the string without using recursion
Implementation:
Implementation:
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(void) { char *s,*v; int flag=1; s=(char*)malloc(sizeof(char)); v=(char*)malloc(sizeof(char)); scanf("%s",s); v=s; while(*s) { if(*s>='A' && *s<='Z') { printf("First capital letter in %s is %c",v,*s); flag=0; break; } s++; } if(flag) printf("No capital letters found in %s",v); return 0; }