15,550 Topics

Member Avatar for
Member Avatar for D33wakar

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"); …

Member Avatar for TrustyTony
0
449
Member Avatar for kkanedaa

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" || …

Member Avatar for kkanedaa
0
419
Member Avatar for DesignGhosts

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: …

Member Avatar for DesignGhosts
0
477
Member Avatar for mullan123

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 …

Member Avatar for Narue
0
89
Member Avatar for yakovm

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 …

Member Avatar for Narue
0
94
Member Avatar for ankit_the_hawk

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 …

Member Avatar for thisun
0
13K
Member Avatar for Simplified

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" …

Member Avatar for Simplified
0
111
Member Avatar for Prankmore

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 …

Member Avatar for Prankmore
0
196
Member Avatar for Madawar

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"); …

Member Avatar for plebbeh
0
1K
Member Avatar for peter_budo

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

Member Avatar for Siddhartha_90
0
490
Member Avatar for jenny666

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 …

Member Avatar for jenny666
0
103
Member Avatar for logicmonster

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 …

Member Avatar for Narue
0
1K
Member Avatar for coril

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){ …

Member Avatar for Narue
0
1K
Member Avatar for justin96b

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; } …

Member Avatar for Nick Evan
0
149
Member Avatar for logicmonster

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 = …

Member Avatar for Ancient Dragon
0
166
Member Avatar for ashu12v

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 …

Member Avatar for N1GHTS
0
472
Member Avatar for Prankmore

[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, …

Member Avatar for gusano79
0
235
Member Avatar for largedimples

[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 = …

Member Avatar for WaltP
0
243
Member Avatar for dotancohen

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.

Member Avatar for keshvari
0
194
Member Avatar for sayoojya
Member Avatar for stereomatching

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 …

Member Avatar for nezachem
0
1K
Member Avatar for kooletz

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; …

Member Avatar for WaltP
0
188
Member Avatar for little_bee

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<

Member Avatar for Adak
0
126
Member Avatar for kooletz

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 …

Member Avatar for WaltP
0
164
Member Avatar for siddiqui_1985

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 …

Member Avatar for HASHMI007
0
153
Member Avatar for tubby123

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 …

Member Avatar for Narue
0
86
Member Avatar for tubby123

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 …

Member Avatar for Narue
0
90
Member Avatar for MarounMaroun

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 …

Member Avatar for Ancient Dragon
0
127
Member Avatar for D33wakar

[CODE] #include <stdio.h> float pows(float,float); int main() { float num,base; printf("enter base followed by power integer."); scanf("%f %f",&base,&num); printf("%f ",pows(base,num)); return 0; } float pows(float base,float n) { if(n==0) return(1); else if(base==0) return(0); else for(;n>=1;n--) { return(base*pows(base,n-1));/*recursive*/ } } [/CODE]

Member Avatar for D33wakar
0
147
Member Avatar for Towmator

Howdy! So I'm taking this online intro to C class and have not been able to get in touch with my instructor because I think he's on vacation.Grrrrr. Anyway, If someone could give me some hints on what is wrong with this code I would really appreciate it. I am …

Member Avatar for WaltP
0
113

The End.