15,550 Topics
| |
Hi everyone I have a simple piece of code thus: char userChoice = '\0'; validate:; printf("Please make a choice [y/n] \n"); //fflush (stdout) ; scanf("%c", &userChoice); if(userChoice != 'y' && userChoice != 'n' ) { printf("\nInvalid input; please enter y or n. \n "); userChoice = '\0'; goto validate; } … | |
#include<stdio.h> int arr[20]; int main() { int n,i; printf("Enter the size of array\n"); scanf("%d",&n); printf("Enter the elements:"); for(i=0; i<n; i++) scanf("%d",&arr[i]); merge_sort(arr,0,n-1); printf("Sorted array:"); for(i=0; i<n; i++) printf(" \n %d",arr[i]); return 0; } int merge_sort(int arr[],int low,int high) { int mid; if(low<high) { mid=(low+high)/2; merge_sort(arr,low,mid); merge_sort(arr,mid+1,high); // Combine merge(arr,low,mid,high); } … | |
| Can anyone give me the nest links so as to learn socket programming in C from net ? As i have searched net a lot and also have read many things, but i want you all to tell some more better links. thanks in advance. |
i cant run my program even my directories are correct.......!! my flashdrive is in (F;) then in my directories are: Include Directories F:\TC\INCLUDE\ Library Directories F:\TC\LIB what will i do.....?? | |
[code]void strcpy(char *s, char *t) { while ( (*s++ = *t++) != `\0);}[/code] i saw this code in a particular book..... in the what does the assignment statement (*s++=*t++) return each time it gets executed........ all along i was thinking that the assignment statement return a 0 or 1 based … | |
to input an unsigned integer and reverse the first and last nibble of the number | |
I want to make a program that analysises which key has been pressed the most as a part of my school assignment. I want that the key input be recieved by my program and later by the program it was intended for. Is there a way to do this? Please … | |
| Can anybody give me code snippet for finding the nth fibo number in logn time using matrix exponentiation ? thanks in advance. |
struct abcd { char q; int w; //long int e; }; why size of this structure is 8 bytes and if i include **long int e** , size becomes 12 bytes? | |
just like java has sun microsystem certification exam what is for c certification? | |
I am in first sem in university.. and i can't do it alone ~~ http://www.mediafire.com/view/?1nqlfsuc3nrg4cc any one can help to solve those 3 questions or any one ^^ | |
| hi.. can anybody please tell me that how can i print the execution time for my code ? Actually, what exaclty i want is that my program should also print the time which is elapsed while executing it or for maupulating any i/p. any pre-defined or user-defind function which can … |
#include <stdio.h> #include <stdio.h> #include <stdlib.h> #define p printf #define s scanf int total( int q, int w); void gemar(void); void gem(void); int setfunction (int *team1score,int *team2score); static int team1score_set1 ; static int counter1_set1 = 0; static int team2score_set1 ; static int counter2_set1 = 0; static int team1score_set2 ; static … | |
can anyone tell the output of following code and also explain it #include<stdio.h> #include<stdlib.h> union employee { char name[15]; int age; float salary; }; const union employee e1; int main() { strcpy(e1.name, "K"); printf("%s %d %f", e1.name, e1.age, e1.salary); return 0; } | |
Is main(); function included as loop statement? for example i have a program with subprograms then if I finished a subprogram i will use main(); function to go back from the main program. is that considered as loop? thanks!! | |
Hi, first i need to download a good compiler, what can you recommend me? I always used dev-c++ but in windows 8 don't work, it gives this error: "gcc.exe: Internal error: Aborted (program collect2)". Well, i need to get content from json files to make a sql sentence, insert into. … | |
** # is it possible to creat threads in c-programming? # ** ## Sub-Heading Here ## yes,then how? no, then why not? | |
Hello, I have an array string as character[i] = "john" Now, when i supply 'o', it should return me the array index from above as '1'. 'j' as 0 'o' as 1 'h' as 2, etc. Please help | |
I have some strange problem which i started facing from yesterday. i have used GDB many times on my system , but yesterday when i started running GDB , my dubugger is enterings the library functions code part also which is very irritating for me. I mean if the program … | |
Hi guys, I'm facing a new problem. Now I'm learning how to send signals to process in order to make them communicate. I was trying to create a process and when this process is created, send a signal to his father... But I had no success. I get a bunch … | |
I'm trying to make a C program to run DOS commands but I keep getting "illegal command" error. Here's the code. #include<stdio.h> #include<process.h> int main() { system("ipconfig/all"); return 0; } | |
Considering the following lines of C code: #include <stdio.h> #include <stdlib.h> #include <ctype.h> void print_upper(char *string); int main() { char s[80]; printf("enter a string\n"); gets(s); print_upper(s); printf("\ns is now in upper case: %s",s); return 0; } void print_upper(char *string) { register int t; int k; for(t=0;string[t];++t) { string[t]=toupper(string[t]); putchar(string[t]); } … | |
| hi... Can anyone please explain that why we always take 6 points into consideration while finding closet pair of points in a given set of points ?This problem is solved using divide and conquer algorithm. And if anyone please give me psuedo code for closest pair problem, then i will … |
I should write a program for school classification. It should give out all the 5 marks, but nobody can be on the border points or near the border points. Thanks in advance for your help! | |
hello guys, I 've just recently stated writing algorithms in Data structures. I want questions to write algorithms in array and linked list, please give me questions in that. The questions can be of difficulty level easy and medium. thank u. | |
I have Google'd and all i found was outdated, buggy or not working source samples. Here is what i tried but i have a bit of a problem: [CODE]void toDecimal(char bin[]){ int i, d = 0; int l = strlen(bin)-1; int x = 1; for(i = 0; i < l; … | |
hello friends, could you guide me how i can write my own version of malloc and free function | |
help me with a c program that inputs a year number and number of years,then to determine which of those years were leap years | |
#include <stdio.h> #include <stdlib.h> int fact(int); int main() { int n,total=1,i; printf("enter the series limit: "); scanf("%d",&n); total=total+n; for(i=2;i<=n;i+=2) { total=total+(pow(n,i)\fact(i)); } printf("%d",total); return 0; } int fact(int c) { int j=1; int facto=1; for(j=1;j<=c;j++) { facto=facto*j; } return facto; } my output should be like this 1+n+n*n\2!+n*n*n*n\4! the error … |
The End.