EmbLogic's Blog

Author Archives: Mehul Sharma

Record maintained using structure

1#include <stdio.h> 2 struct student 3 { 4        char name[50]; 5            int roll; 6                float marks; 7 }; 8 int main() 9 { 10 { 11         printf(“===========================================\n”); 12         printf(”                menu                       \n”); 13         printf(“===========================================\n”); 14         printf(“1.add student record\n”); 15         printf(“2.delete student … Continue reading

Posted in Uncategorized | Leave a comment

concatinate two strings using function,pointer and memory allocation

#include<stdio.h> #include<stdlib.h> int main() { char a[20]={0},b[10]={0}; int i,j=0; printf(“Enter name1:\n”); scanf(“%s”,a); printf(“Enter second name:\n”); scanf(“%s”,b); for(i=0;i<20;i++) { if(a[i]==”) { a[i]=b[j]; j++; } } printf(“Concatination is: %s\n”,a); return 0; }   note: – output enter the name 1=hye enter the … Continue reading

Posted in Uncategorized | Leave a comment

program to attach two string

1#include <stdio.h> 2 #include <string.h> 3int main() 4 { 5 char a[100],b[100]; 6  printf(“Enter the first string\n”); 7          fgets(a); 8           printf(“Enter the second string\n”); 9          fgets(b); 10           strcat(a,b); 11           printf(“String obtained on concatenation is %s\n”,a); … Continue reading

Posted in Uncategorized | Leave a comment

file handling

#include<stdio.h> #include<stdlib.h> #include<fcntl.h> int main() { int count,fd; char buf[50]; fd=open(“filem.c”,O_RDONLY,S_IRWXU); count=read(fd,buf,50); if(fd<0) { perror(“open”); exit(-1); } printf(“the value of count=%d and value of buf=%s”,count,buf); close(fd); }   note :-       where file : filem.c contain data “she sells sea shell … Continue reading

Posted in Uncategorized | Leave a comment

Program to combine two words without string char or compair

#include<stdio.h> int main() { char j,i,a[15]=”hello”,b[15]=”world”,**p; while(a[i]!=”) { i++; } for(j=0;b[j]!=”;j++) { a[i+j]=b[j]; } printf(“%s”a)   }

Posted in Uncategorized | Leave a comment