15,552 Topics
| |
Hi, I am trying to read a text file and tokenize the data and store in a character array. [code] #include<stdio.h> #include<stdlib.h> #include<string.h> //#include<file.h> int main(int argc , char *argv[]) { printf("No of arguments %d \n",argc); printf("Argument no 1 is %s \n" ,argv[1]); FILE *fp; char buffer[11]; char *bp; char … | |
Hi All I have a simple quick question: does anyone have any recommendations on a graphing with C? I've done some graphing in the past with Python using Matplotlib and rather than re-invent the wheel I was hoping that someone might be able to point me in the right direction … | |
Here's a code to find out if the number is palindrome or not. [CODE] #include <stdio.h> int main() { int num,chknum1,chknum2=0,i,rmndr;/*here rmndr is remainder after mod,chknum is reversed num*/ printf("enter the number"); scanf("%d",&num); chknum1=num;/*saving num,since it is manipulated*/ for(i=0;i<=sizeof(chknum1);i++) { rmndr=num%10; num=num/10; chknum2=chknum2*10+rmndr; } printf("chknum1 %d,chknum2 %d",chknum1,chknum2); //if(chknum1=chknum2) //printf("Is palindrome"); … | |
Hello, I want to know how to compare a string value which is input by the user. The following code gives an error saying "Result of comparison against string literal is unspecified (use strncmp instead)". [CODE] while(valid == 0) { printf("Yes-No-Question\n"); scanf("%s", &yesno); valid = 1; if(yesno != "yes" || … | |
Hi guys, This might be a long shot but its worth a go....so im using LabWindows CVI, a ANSI C software development environment for "test and measurement, data acquisition, instrument control, and scientific analysis" application. Now the problem I have is running a .exe application from a button click event: … | |
Hello, I am working on a simple shell and I need to add the ability to handle program names and parameters that contain white space: everything in between two double quote (") characters needs to be treated as one word! E.g. "./hello world" should be treated as the name of … | |
I have a program which prints (by printf) to the stdout some data and also calls to function *foo* which also prints to the stdout some data [the way (implementation) of how printing is done from foo is unknown and I can`t see the code of foo]. I have to … | |
I have been experiencing problems in using the gets() command in C. Whenever I use it twice followed by scanf for eg: [code] char name[20],add[20]; printf("Enter name : "); gets(name); printf("Enter address :"); gets(add); printf("Enter age :"); scanf("%d",age); [/code] Here it skips name.(doesnot take input of name!) It doesnot input … | |
Hi All I'm learning C at the moment using Code::Blocks running on Windows 7 (64-bit) and I'm having a bit of a problem with code that I've compiled. This code works and compiles just fine: [CODE]#include <stdio.h> int main() { char cards[] = "JQK"; char a_card = cards[2]; /* "K" … | |
I'm trying to determine then print the country of origin of a product based on its bar-code. I have isolated that part of the bar-code and stored it as countryCode, now what i am trying to do is determine its country then store the country name as a string so … | |
Why is this not working [CODE]//Character Manipulation #include <stdio.h> int main() { int x; //for loops int counter=0; //for input char character; char sentence[20]; printf("Press 1 to use getchar \n Press 2 to use gets \n Press 3 to use sscan \n "); scanf("%d",&x); switch(x) { case 1: printf("Enter something"); … | |
People did any of you come across good tutorials on hash tables??? What I got from schools is useless and teacher is not able to explain properly. Thanx for help | |
Hello, im writing a C program that needs to get a value from my database and put it into a temporary table. so far i can get the value from the database and insert it into my temp table. if i fill in the right value in the where clause … | |
Is it even possible to create a singly linked list using a function outside of main and then access it once you leave the function? pseudo: [CODE]#include //whatever needs to be included function{ \\create and link lists in this function } main{ funtion()//call function to create lists and link properly … | |
I'm trying to read user input and store it as a string including the whitespace. I did a search for a solution and was pointed to fgets() or scanf(%[^\n], str). But both these solutions give me an error. This is what I have: [CODE] scanf("%d", &input); if (input == 1){ … | |
so here is my code -- whenever i try to compile it says SYNTAX error [CODE] #include <stdio.h> long FindMaximum(long* numbers, int count) { long max = numbers[0]; int i; for(i = 0; i< count; i++) { if (numbers[i] > max) { max = numbers[i]; } } return max; } … | |
I have to open and read a file whos file name is provided through a command line argument. Right now, I am using the following method. My main: [CODE]#include <stdio.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #include "functions.h" int main(int argc, char *argv[]) { int count, string_size; int other = … | |
Hi, Borland C++ 5.5 isn't working.:@ Test file [B]Hello.c [/B][CODE]#include <stdio.h> int main(void) { printf("Hello world!\n"); return 0; }[/CODE] [B]Output :[/B] C:\Users\Administrator\Documents>bcc32 Hello.c Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland Hello.c: Error E2209 Hello.c 1: Unable to open include file 'stdio.h' Warning W8065 Hello.c 5: Call to … | |
[CODE=c]# include<stdio.h> # include<string.h> # include<stdlib.h> int main(int argc, char **argv){ // Declare Variables char barcode[50]; int count; long long intBarcode; long countryCode; int dig0, dig1, dig2, dig3, dig4, dig5; int dig6, dig7, dig8, dig9, dig10, dig11; long long num; long rem, sum; int checksum; long long manufac, product, language, … | |
[B]Will some one please help with the topological sort problem. What am I doing wrong? Thanks in advance for your help!! [/B][code=c] #include <stdio.h> #include <limits.h> class Vertex { public char label; public Vertex(char lab) { label = lab; } } public class Graphs { private final int MAX_VERTS = … | |
Considering the following line of code: [code]int *ip;[/code] Is "ip is a pointer to int" (the type) or is "ip a pointer to an int" (a particular variable of type int)? Thanks. | |
Write a C program to find the factorial of a number using do while loop? | |
I found some implementation by macro with the help of macro I may write something like [code] #define DEFINE_LIST(type) \ typedef struct list_node_##type { \ struct list_node_##type *next; \ type data; \ } int main() { DEFINE_LIST(int); // defines struct list_node_int DEFINE_LIST(double); // defines struct list_node_double IMPLEMENT_LIST_INSERT(int); // defines list_int_insert … | |
Please help me, I already made a programm it run good if i only input a first name but if i input first and last name it did'nt work properly here is the program i made and the output of the program PROGRAM [CODE]#include <stdio.h> #include <conio.h> #include<math.h> char a,name; … | |
I just need to have 3 basic problem statements on c programming that is related to the field computer engineering, computer science or electronics and communications engineering. Only 3, and i can sleep.. of course after coding. :) THANK YOU! ^_^ >:D< | |
PLEASE HELP I NEED TO PASS THIS HOMEWORK AND I ONLY HAVE 16 HRS BEFORE I SUBMIT IT AND I ALSO HAVE ANOTHER ASSIGNMENT ON MY ENGINEERING MATH, CALCULUS AND SOLID MENSURATION I DON'T HAVE ENOUGH TIME TO FINISH THIS PROGRAM PLS SOMEONE HELP ME WITH THIS THANKS IN ADVANCE … | |
Hi Everyone!! I have a little problem in printing Character Arrays.... i have enclosed my code below. what problem actually i have is that when i type my first name and after first name (space bar) last name.. it prints only my first name. i want to type whole name … | |
Guys, ok after trying around stuff, I get that this is the way you initialize a structure in C. [CODE]#include<stdio.h> #include<conio.h> typedef struct s { int data; char gender; }st; st s1={5,'a'}; int main(void) { printf("%d "%c",s1.data,s1.gender); getch(); return 0; } [/CODE] But suppose i make a new instance of … | |
I have this really weird doubt in extern usage Consider the code [CODE] #include<stdio.h> int main(void) { extern int a; printf("%d",a); getch(); return 0; } int a=20;[/CODE] How is it that this code gives the output as 20 ??? My guess Since its an extern variable, it can be declared … | |
Hello, I'm trying to read lines from a file and strtok it into a double array to work with the numbers. The numbers are separated by ',' and I'm trying to fill array (line[]) with these numbers. This is part of the code. [code=c] while(1) { //we will scan all … |
The End.