Q1 Write a C program called take as command line input a var
Q1: Write a C program called take as command line input a variable number of strings and store in a linked list the uppercase equivalent of each string. Each new string should be inserted at the HEAD of the linked list. Each node of the linked list should contain 2 variables: i) a character array to hold a string, ii) a pointer to the next node in the linked list. It should also contain a function void print_linked_list(struct *node) to iterate over the linked list and print the strings stored in each node of the linked list.
Solution
#include<stdio.h>
#include<conio.h>
int string_ln(char*);
void main() {
char str[20];
int length;
clrscr();
printf(\"\ Enter any string : \");
gets(str);
length = string_ln(str);
printf(\"The length of the given string %s is : %d\", str, length);
getch();
}
int string_ln(char*p) /* p=&str[0] */
{
int count = 0;
while (*p != \'\\0\') {
count++;
p++;
}
return count;
}
