15,552 Topics
| |
Can anyone please explain me, step by step, each line of the following sorting algorithm which sorts the input lines numerically, if -n is given at the command line. (Program taken from the book "The C programming language, by brian kernighan and Dennis Ritchie" - Chapter 5. Section 5.11, page … | |
[CODE] int i=5,j=10; printf("%d\n",(i=15)||(j=26)); printf("%d %d\n",i,j); [/CODE] THe output I expected was : 1 15 26 The actual output was: 1 15 10 In (i=15)||(j=26), shouldn't the brackets be done first?Isn't that the precedence order? So,first i must take 15 then j must take 26 then the || must be … | |
[CODE]#include<>stdio.h main() { int n,s=0,i=1; L1:printf("enter a range of numbers:"); scanf("%d",&n) if(n<1){printf("\wrong input"); goto L1;} while { s+=i; i+=2; } printf("\nthe sum of the series is=%d,s"); getch(); }[/CODE] the above program is meant to find out the sum S=1+3+5+7+....+N can any on explain me,the significance of talking i+=2?? | |
Hi ! everyone. I can write small [B][I]"C" Language[/I][/B] programs, compile them in an IDE like Turbo C. But how to make a complete [B][I]Working Software Application[/I][/B] . Do i need only one .c file or many others. How to make a complete large piece of software system as opposed … | |
Following code when executed, prints out a smiling face (ASCII equivalent of integer 2), but when the format specifier in printf is changed from %c to %d, it does not print integer 2. Any reasons why.... [CODE]main() { int i; int *c; char b[10]={1,2,3,4,5,6,7,8,9,0 }; c=&b[1]; printf("\n%c",*c); }[/CODE] | |
#include<stdio.h> #include<string.h> main() { int n; char aan = 'y'; while (aan == 'y') { printf("entr ") ; scanf ("%d", &n) ; printf("sq of %d is %d", n, n*n ); scanf ("%c", &aan); printf("\n want aan y/n""\n"); } } I want to make this using while loop. kindly tell me … | |
some one help me pls.. segmentation fault for merge_sort....:( [CODE]#include<stdlib.h> #include<stdio.h> void merge_sort(int [],int ,int ); void merge(int [],int ,int , int); int main() { int i,n,a[25]; printf("enter the no of elements:"); scanf("%d",&n); for(i=0;i<n;i++) { printf("enter the element:"); scanf("%d",&a[i]); } merge_sort(a,0,n-1); for(i=0;i<n;i++) { printf("%d\n",a[i]); } return 0; } void merge_sort(int … | |
hi... :).. I have to generate a Timetable project by useing C program. i do't have no idea how to generate the code.. so please send me some codes.. and tell some idea to generate.. with your help, i try and complete my project. Thanking you | |
I'm doing an exercise about pointers in this C book i'm reading. This code should traverse through a linked list and there's a function that removes an entry from the list. It works, and I don't know why. The function removeEntry is undeclared int the main() function. Here's the code: … | |
I am trying to create a program for the RSA algorithm. I have managed to get the public keys, but I hit a brick wall trying to figure out how to generate the secret key. I have tried, but the output is either incorrect or doesn't output at all. my … | |
I have problem in this c program [CODE] #include <stdio.h> int main() { int this_is_a_number; printf( "Please enter a number: " ); scanf( "%d", &this_is_a_number ); printf( "You entered %d", this_is_a_number ); getchar(); return 0; }[/CODE] when i press ctrl+F9 the output screen appears " Please enter a number:" and … | |
Friends i've a question to solve... it says,i've to display a menu wer i,ve to open a file and enter a news article..the user is asked to enter keywords for that article.. in 2nd option user can search for a file by inputting dose keywords.. [I]my question is how do … | |
[CODE]#include<conio.h> #include<stdio.h> main() { char name[20]; scanf("%s",&char); if(char=="name") { printf("u entered name"); } else { printf("not name"); } }[/CODE] but it is printing not name when im entering name plzz check for the problem | |
[CODE]#include<stdio.h> int main() { char ch; if(ch = printf("")) printf("It matters\n"); else printf("It doesn't matters\n"); return 0; }[/CODE] Here according to me, the expression inside "if" will be true becoz we have used "=" sign and not "==" sign. but the output is "It doesn't matters".how is it so? | |
I was installing Turbo C on my PC and it says "Make sure you insert \TC\Bin into your DOS path". Now how is that done. | |
[CODE] #include<stdio.h> #include<conio.h> #include<string.h> int x; char name[20]; main() { printf("Exercise no. 10 ESN 211-9A MWF 7:30-9;30\n\n"); printf("Enter your age:\n"); scanf("%d",&x); if (x<18) printf("UNDERAGE!\n\n"); else if (x==18) printf("STUDENT LICENSE POSSIBLE\n\n"); else printf("PROFESSIONAL LICENSE AVAILABLE\n\n"); printf("Enter the result of your drug test: \n"); scanf("%s",&name); if ( name == "positive" ) printf("HOLD … | |
I don't really know where to post this thread but since my code in creating the firmware is in c, I'll try my luck here. I have an application that basically appends all files (u-boot, kernel, rootfs, etc.) into one bin file which forms my firmware file. I'm having a … | |
Hi, i would like to know if there is a function in c that allows me to search for a specific character in a file, and how to use it. Thanks in advance | |
| |
I got some problems with my program here. There are lots of lacking in my code. Hope you can help me with this guys. I'm still a student. Here's the problem: A program that prints figures of (*): 1. Displays a menu [1] Figure 1 [2] Figure 2 [3] Figure … | |
This program I wrote is supposed to restart tor, wait 5 seconds, then look for a PID number using regex. It compiles and runs fine but the regex logic never displays "good". I'm confused. [CODE]#include <sys/types.h> #include <regex.h> #include <stdio.h> #include <string.h> // gcc -o tor_restart tor_restart.c // chown root … | |
Can someone help me to create a syntax for a christmas tree... (the christmas tree must be like the shape of a true to life one) thanks. | |
Hello. My whole code is bellow and I getting the error message: {"responseData": null, "responseDetails": "Suspected Terms of Service Abuse. Please see http://code.google.com/apis/errors", "responseStatus": 403}. Do you have some suggestion? [CODE]#include <fstream> #include <vector> #include <iostream> #include <sstream> #include <string> #include <stdio.h> #include <stdlib.h> #include "/usr/include/curl/curl.h" #include "/usr/include/curl/easy.h" size_t write_data(void … | |
[code] #include<stdio.h> typedef struct node { int data; struct node * link; }n; void addatbeg(n *); void display(n *); n* first=NULL; int main() { int ch; printf("%u",first); while(1) { printf("\n enter 0 to terminate else any other key"); scanf("%d",&ch); if(ch==0) break; addatbeg(first); } } void addatbeg(n* first) { int ele; … | |
segmentation fault...:( some one help me pls.. [CODE]#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { char a[50]; char *x[10]; int i,j,n; char *temp; printf("enter the no of strings:"); scanf("%d",&n); for(i=0;i<n;i++) { printf("enter the string:"); scanf("%s",a); x[i]=(char *)malloc((strlen(a)+1)*sizeof(char)); if(x[i]==NULL){ printf("malloc not done"); exit(1);} strcpy(x[i],a); } for(i=0;i<n-1;i++) { for(j=0;j<n-i;j++) { if(strcmp(x[j],x[j+1])>0) { strcpy(temp,x[j]); strcpy(x[j],x[j+1]); … | |
I have been trying to support certain built in commands such as 'cd' and 'help'. If I do 'ls' or 'mkdir' it executes them fine and they do what they are supposed to. If I type the command 'help' I get a segmentation fault and if I type 'cd' it … | |
please help me understand when does one use *n=m and when to use n=&m [code]int *n,m; *n=5; m=2; *n=m;[/code] //gives an error | |
I'm Using [ICODE]fwrite[/ICODE] to print the contents of a sturcture in a file. [CODE] #include <stdio.h> #include <stdlib.h> struct com{ int code; char* name; }; int main() { struct com py[2]={{21,"Monty Python"}, {22,"Python lang"} }; FILE * fp; if((fp=fopen("data.txt","w+"))==NULL) exit(1); fwrite(&py,sizeof(struct com),1,fp); /*int i; for(i=0;i<2;i++) fprintf(fp,"code:%d,name:%s\n",py[i].code,py[i].name); */ fclose(fp); return 0; … | |
I was trying the following TSR which is supposed to capture interrupt no.8 and change screen color every 10 seconds. But either the linker shows a "not enough memory" error, or, nothing appears to happen. Also the program does not seem to be entering the function our(). Please help... [CODE]#include … | |
Hi there, I am not able to visualize what this code exactly creates in the memory, though I can understand that this is array of pointers: char *dic[][40] = { "atlas", "A volume of maps.", "car", "A motorized vehicle.", "telephone", "A communication device.", "airplane", "A flying machine.", "", "" /* … |
The End.