15,552 Topics
| |
| hi, int common(node *temp,int c,int d) { int a=0; if(temp==NULL) return 0; else if(temp->a==c || temp->a==d) return 1; a=common(temp->left,c,d)+common(temp->right,c,d); if(a==2) { printf("%d\n",temp->a); // break; return 0; } else return a; } this is my recusrion code. Actually, I want to end this recusrion process by adding some statement where i … |
| hi, int arr[2][2][2]={1,2,3,4,5,6,7,8}: int *p,*q; q=(int*)arr; printf("%d",*q); my question is that how is it giving output as "1"(ofcourse, without quotes). what will change if i don't typecast arr in 3rd line of code? will anyone please explain.Is it giving o/p "1" ,just because of that typecast ? my thinking: as … |
I want to implement public key cryptography in my poject. How to implement using c langugae. Is there any library or api. Thanks for help | |
#include <stdio.h> #include <stdlib.h> void main() { char a[50]; int n; printf("enter the string : "); gets(a); n=strlen(a); printf("%d",n); for(i=n;i>0;i--) { printf("%c",a[i]); } } the error is at i=n why cant we use i=n; | |
Hi geeks, I'm using visual studio to write and execute programs. I want to create breakpoint not like software breakpoints(F9 for debugging). I want to build the project in release mode and want to have breakpoint. I heard something like _asm int 3 to create breakpoint. Can anyone explain _asm … | |
The computer is a binary beast. We want to go from the one-fingered digital box to the ten-fingered human being and convert binary to denary(base 10) numbers. This is how it works, for instance, binary 10010 is calculated as 1*16+0*8+0*4+1*2+0*1 = decimal 18. Just because it's easy, let's throw in … | |
#include <stdio.h> #include <stdlib.h> void main() { char str[10],str1[10],str2[20]; int i,j,k; printf("enter string1: "); gets(str1); printf("enter the string 2: "); gets(str2); for(i=0,j=0;str1[i]!='\0';i++,j++) str[j]=str[i]; for(i=0,k=j;str2[i]!='\0';i++,k++) str[k]=str2[i]; printf("%s",str); } not producing correct output | |
#include <stdio.h> #include <stdlib.h> void main() { int a=5,b=10,*ptr,*pt1; ptr=&a; pt1=&b; b=*ptr; a=*pt1; printf("%d \n %d",a,b); } producing same values not swapped | |
| hi.... int x=30, *y,*z; y=&x; assume x address is 500 and int is of 4 bytes z=y; *y++=*z++; x++; printf("%d %d %d",x,y,z); i want to ask that how the value of y is 504 here ? firstly value of z is assigned to value of y. then z is incremented … |
Hi! I'm constructing a code for parsing results in an html form and I'm having problems with strcat. It's really weird 'cause I'm positive the syntax and all that are all correct. I can't seem to find where the problem is. Basically, I have this non-empty string "copy" and when … | |
hi i want to convert the prefix form to postfix,prefix and infix form but when i input +5*62 it retuns only 2 what is wrong with my code can anybody help to solve this #include<stdio.h> #include<conio.h> #include<stdlib.h> #define Operator 1 #define notOperator 0 #define empty -1 struct node{ char item; … | |
hi! everyone. please could you give me some** great project ideas in C language**. Projects which deliver a practical solution to a problem . At the same time ,could you give some advice on how to start and end it perfectly. Thanks. | |
When i declare array in c before main method it gives, an error. Declaration is char a[65000]; main() {} and another declaration in other file char a[63000]; main() {} has no error what is the reason. | |
#include <stdio.h> #include <stdlib.h> #include<string.h> void main() { char name[30],mname[40]; printf("enter the num:"); gets(name); strcat(name,123); printf("%s",name); } is it possible to concatenate num and character its not working how to concatenate numbers and character | |
| hi, int fun(int(*)()) { ....... ....... ...... } int main() { ....... ...... ....... fun(main); ........ ........ } my question is that how can we use "main" (only name without parenthesis) as the pointer to a function ? because main() is a function. I am not getting it how is … |
how to do the total of value in the array ben[20] have to use function or other ??????? #include<stdio.h> #include<stdlib.h> void main() { int ben[20]; printf("pls enter 20 no\n"); for (int i=0; i<20; i++) { scanf("%d",&ben[i]); } system("pause"); } | |
#include <stdio.h> #include <stdlib.h> void main() { char a[30],b[30],i; printf("enter the a: "); gets(a); for(i=0;a[i]!='\0';i++) { b[i]=a[i]; } printf("%d",b); } it produces a wrong output | |
I have to wirte a code for monte carlo pi approximation for a menu driven calculator. here is my code but when i run it it shows me 1 instead of the pi value. can someone tel me what is wrong. double approximatepi(void) { double x,y,z,pi,randomnumber; double r,p,in; int tries; … | |
| hi.. im new here, and this will be my very first post ever in this website.. i am using Dev C++.. so can you help me out a little here?? i have this code.. yes, some of these codes are found all over the internet.. but most of the code … |
how do i implement a c program that removes all nonalphabets in the given string?? | |
Ok, I'm really having a hard time with this, but I don't even know what I'm missing. I t should be easy. Here's the problem: You have a linear equation system: a1x+a2y=a3 // a4x + a5y=a6. Ask for a1, a2, a3, a4, a5 and a6 as input, solve x and … | |
generally we can build a application in java and vb make it as a exe.but how do we build application using c or c++.even some operating systems like xp was written in c++.how is it possible????/ | |
Hello, can anyone suggest me how to execute graphics programs(such as DDA line algo) using GCC compiler under windows? graphics.h is a part of turbo c and is not available in gcc.. so is there any way to do this?? | |
char a[5000]; main() {} and in another file main() { char a[5000]; } after compiling both file. exe of both file size have large difference. why | |
what is determinanat of matrix i have a code i dont understand what is the logic behind | |
In C++ you have this: std::string = "Name"; You can also read file with it, unlike reading the contents into a char[] with a limited amount of memory. So whats is C equivalent of a C++ string? | |
Write a computer program using the C Language which reads any base-10 number from the standard input (keyboard) and writes its binary and hexadecimal representation to the standard output (monitor). this is what I have and I am super confused and need help please. and I have to create this … | |
I am getting this output: This is the source string╠This is a destination string╠╠╠╠╠╠╠╠╠╠╠╠╠╠5Press any k ey to continue . . . My code is: void Problem5(char strDestination [], char strSource []) { int intIndexOfStrSource = 0; int intConcatenatedStringIndex = 0; int intStringDestinationIndex = 0; int intLengthOfDestination = strlen(strDestination); int … | |
#include<stdio.h> #include<string.h> int compare_string(char *first, char *second) { while(*first==*second) { if ( *first == '\0' || *second == '\0' ) break; first++; second++; } if( *first == '\0' && *second == '\0' ) return 0; else return -1; } int main(void) { char string[1000]; char word[20]; char *s; int len; … |
The End.