15,552 Topics
| |
char str[]="S\065AB"; printf("\n%d", sizeof(str)); explain the output. i am getting 5. | |
> WHAT SHOULD WE LEARN OTHER THAN C LANGUAGE TO DO PROJECTS IN C..??PLEASE HELP... | |
I have executed the below program several times, most of the time i got the same out put but some times output is different. sample out put is: > skylab@skylab:~/Nx/Thrds$ gcc 3.c -lpthread > skylab@skylab:~/Nx/Thrds$ ./a.out > Scheduling policy = ??? > arg = 20 > 1arg = 20 > … | |
what is difference between a)strcpy and memcpy b) memcpy and memmov? | |
i have a doubt how can we use string in matrices for examples a[0][0]=rohinn a[0][1]=rithish how to do this???? | |
#include <stdio.h> #include <stdlib.h> main() { char a[30],b[30]; int i,j,n; printf("enter the limit: "); scanf("%d",&n); printf("enter the string: "); for(i=0;i<n;i++) { scanf("%s",a[i]); } j=strlen(a[0]); printf("%d",j); } here for example it will take 4 words where a[0]=word1,a[1]=word2,a[2]=word3,a[3]=word4 where i have particularly find string length of a[0] in 15 th line i … | |
#include <stdio.h> #include <stdlib.h> void main() { int i,j,n,c[10]; char *str,ch; str=(char*)malloc(20); printf("enter the string: "); fgets(str,sizeof(str),stdin); n=strlen(str); printf("%d",n); j=1; c[1]=0; for(i=0;i<n;i++) { ch=tolower(str[i]); if(ch== '') { j++; c[j]=0; } if(ch=='a'||ch='e'||ch='i'||ch=='o'||ch=='u') c[j]++; } printf("no of vowels in each word in given line is \n"); for(i=1;i<=j;i++) { printf("word is %d-->%d\n",i,c[i]); } … | |
Look into this code: #include <stdio.h> main() { int p,n,r; float si; scanf("%d %d %d", &p, &n, &r); si=p*n*r/100; printf("SI = %f", si); } Output of this program is 100 100 100 SI = 169.00000 **and also this:** #include <stdio.h> main( ) { int p, n ; float r, si … | |
You have to mildly trick Windows, but it is possible to put a bitmap image on your console. Uses a flock of WinApi calls. Works well with the free PellesC compiler and Dev-C++. This is a Windows Console Application. Drop me a comment, if you have luck with another compiler. | |
well, i want to learn some very basic game programming starting from C ,then C++.. How to include that header file <graphics.h> in my IDE like Turbo C or andy other IDE. please help! regards, Techy23. | |
#include <stdio.h> #include <stdlib.h> void main() { int i,j,d=0,k; char a[30],b; printf("enter the string: "); fgets(a,sizeof(a),stdin); printf("enter the first character to be searched and printed: "); scanf("%c",b); for(i=0;a[i]!=32;i++) { if(b==a[i]) { printf("%c",a[i]); } } for(i=0;a[i]!='\0';i++) { if(a[i]==32) { i++; k=i; if(b==a[i]) { for(k=i;a[k]!==32;k++) { printf("%c",a[k]); } } } } } … | |
Dear All, We are capturing each network packet which is in this format. The problem is that we would like to get the url if it exist in the packet in the form of http://...... ? What is the best whaay to interpret it to capture the url? 000000 cf … | |
#include <stdio.h> #include <stdlib.h> void main() { char s[40]; int i,j,k=0,c=0; printf("enter the string: "); fgets(s,sizeof(s),stdin); for(i=0;s[i]!='\0';i++) { if(s[i]==32) { c++; } } if(c%2==0) { printf("there is no middle word"); } else{ j=c/2; for(i=0;s[i]!='\0';i++) { if(s[i]==32) { k++; if(j==k) { i++; while(s[i]!=32) { printf("%c",s[i]); i++; } } } } } … | |
we are using printf and scanf from #include<stdio.h> libraray functions.is it possible to write our own display statement and input statement | |
#include <stdio.h> #include <stdlib.h> #include<ctype.h> void main() { char str[50]; int i=0; printf("enter the string: "); fgets(str,sizeof(str),stdin); printf("the abbrevation of string is"); printf("%c",toupper(str[i])); for(i=0;str[i]!='\0';i++) { if(str[i]== '') { i++; printf("%c",toupper(str[i])); } } } error at line 14 | |
#include <stdio.h> #include <stdlib.h> void main() { char str[30],str1[30],str2[50]; int i,n,j,k; printf("enter the string: "); fgets(str,sizeof(str),stdin); printf("enter the inserting string: "); fgets(str1,sizeof(str1),stdin); printf("enter the position: "); scanf("%d",n); for(i=0,k=0;i<n;i++,k++) str2[k]=str[i]; for(j=0;str1[j]!='\0';j++,k++) str2[k]=str[j]; for(i=n;str[i]!='\0';i++,k++) str[k]=str[i]; printf("%s",str); } no errors for example output will be like this enter the string:rohinnj enter the inserting … | |
#include <stdio.h> #include <stdlib.h> void main() { char x[10],y[10]; int i,j,k,flag=0; printf("enter the string: "); fgets(x,sizof(x),stdin); for(i=0;x[i]!='\0';i++) for(j=0,k=i;x[k]!='\0';j++,k--) { y[j]=x[k]; } if(x==y) { printf("the string is palindrome"); } else { printf("not palindrome"); } } | |
my professor gave this machine problem as a part of our finals.can you help me out/ here are the instructions: 2 player tictactoe -program a 2player tictactoe game wherein two players alternately key-in the coordinates to which they want to place a 'o' or an 'x' -the game board is … | |
This is how mine [B]strcmp[/B] function would look like if I'd to implement it from scratch :) | |
I am trying to create a basic program with a user defined header file.I created the project in visual studio. #test1.cpp # #include <stdio.h> #include "multiply.h" int main() { int y; y=multiply(5,10); printf("%d\n",y); printf("%s","jigar"); getch(); return 0; } # multiply.h # int multiply(int a,int b); # multiply.c # #include "multiply.h" … | |
Hi! i have to *create a game , purely in C Language*. How to start and how to end? what kind of game can i try to make? which IDE to use ? i cant run <graphics.> header file for graphics in any IDE. How to configure init() = (&gm, … | |
Hi, I having this error and i don't know how to fix it, can anybody help please: "declaration of `c' as multidimensional array must have bounds for all dimensions except the first", i'm getting this error because of : [code]void lcs::LCS_Length(int X[], int Y[], [COLOR=Red]int c[][], char b[][], [/COLOR] int … | |
#include<stdio.h> #include<conio.h> #include<stdlib.h> void main() { char a[100],b[50],c[50]; int i,n,j,k,d; printf("enter the string: "); fgets(a,sizeof(a),stdin); printf("enter the string to be removed: "); fgets(b,sizeof(b),stdin); printf("enter the string to be searched: "); fgets(c,sizeof(c),stdin); for(i=0;a[i]!='\0';i++) { if(a[i]==b[0]) { k=i; printf(" \n the first character is at %d",k); printf("\n lets see whelther searchstring is … | |
My assignmnet is to read a csv into a structure. A few sample lines of the csv look like this: 21, John Henry Blue, 6598 Wish Street, Elves, CA, 54862 9, Chad Vile, 32 Bundle St. , Carver, IN, 28105 I can't use pointers, except to point to the file … | |
1) Write a program to make commandline calculator ? Format like that : excutablefile firstoperand opertator secondoperand Ex : ./a.out 1 + 3 result : 5 | |
#include <stdio.h> #include <stdlib.h> #include<string.h> void main() { char a[200],n,c,b; int i; printf("enter the new string: "); scanf("%20s",a); printf("enter the character to be replaced: "); scanf("%20s",b); printf("enter the new character: "); scanf("%20s",c); for(i=0;a[i]!='\0';i++) { if(b==a[i]) { a[i]=c; } } printf("%s",a); } i have 0 errors when compiler starts to work.it … | |
#include <stdio.h> #include <stdlib.h> void main() { char a[100]; int i,c=0; printf("enter the text: "); scanf("%20s",a); for(i=0;a[i]!='\0';i++) { if(a[i]==32) { c++; } } printf("number of spaces in text is %d",c); } ascii value of space is 32 but it shows o spaces in output | |
| hi... typdef char * hello; const hello ptr1,ptr2; So, in this snippet, my question is that what is constant ? is ptr1 constant or the value to which ptr1 will "point to" will be constant ? and will u please give reason also? my thinking: const hello means (const char … |
| hi, #include<stdio.h> int main() { const int i=10; int *ptr= (int*)&i; printf("%d",*ptr); *ptr=11; printf("%d",*ptr); printf("%d",i); getch(); return 0; } in this, we trickly changed the value of a constant variable. how is it changing the value of i ? in the o/p it is giving o/p , value of i … |
The End.