15,552 Topics

Member Avatar for
Member Avatar for totalwar235

I was attempting to recreate the fibonacci sequence and I made a working code but my code will refuse to use a number above 12. any ideas what is wrong? #include <stdio.h> #include <stdlib.h> int main() { const int user = 1; long int fib[user]; int i = 0; int …

Member Avatar for deceptikon
0
176
Member Avatar for ashish2expert

Hello, Though I have done this question without string functions but can anybody give me short algorithm for this. Here is the question: Write a program that reverse the words in a sentence: Enter a sentence: *you can cage a swallow can't you?* Reversal of sentence: *you can't cage a …

Member Avatar for ashish2expert
0
920
Member Avatar for dewdropz

Hi I have the following code which is giving an error while trying to use scanf with it. Please help resolve uint16_t x[3]={1,2,3}; uint16_t y; printf(" %"PRIu16",y); (works) printf("Enter a value for y: "); scanf("%"PRIu16, &y); warning: format '%u' expects argument of type 'unsigned int *', but argument 2 has …

Member Avatar for deceptikon
0
231
Member Avatar for dewdropz

Help, I am getting a segmentation error. Basically I need a function to print out certain elements of an array. I have created the functions displayArrayVal1 and displayArrayVal2. x_array and y_array are both global. Where am I going wrong? #include <stdio.h> #include <stdlib.h> #include <string.h> #include <inttypes.h> uint16_t x_array[8]={1,2,3}; uint32_t …

Member Avatar for nullptr
0
323
Member Avatar for anumash

I have a lot of problems understanding the concept of size_t and will really appreciate if anybody can help me understand the concept. I searched a lot on the net and went on a multiple forums and answers ranged from "it's an unsigned integer type" to the more bizarre "it …

Member Avatar for deceptikon
0
183
Member Avatar for anestistsoukalis

What is a new project programming ? Is it better writting code in separate files which they can combine together ... rather that making ine file that includes all the other .C files ? At last... if i have 3 files .. for example: **File one:** // * Filename: setadt.c …

Member Avatar for deceptikon
0
209
Member Avatar for andrisetia

hi there, i also have an emergency home work it about Fibonnaci recursive the Output is should be like this : -------------------------------------------------- First number of the fibonnaci : 3 The Fibonacci Lines are : 3 4 7 11 18 29 ... ---------------------------------------------------- i want the result is until 10 lines …

Member Avatar for deceptikon
0
258
Member Avatar for kewlankit

A fest called "Technothon" is going to be held in my college. In this fest, CEO's of large MNC's are invited. I am to present a project in front of them. So, please suggest some project ideas.. "C" language is my strong point. But i have got no idea about …

Member Avatar for Miorfs
0
215
Member Avatar for murali89

Hi, I am facing difficulty in removing a node from linked list. For example I am having four nodes having integers (10) (20) (30) (40). I need to remove second Node that is 20 from linked list. What i was trying to do is I am maintaining two pointers to …

Member Avatar for Ancient Dragon
0
174
Member Avatar for ThatJamaican

**I have about 54 errors and I have no idea why. I've been looking through it and I see nothing whenever I change anything, more errors that are related to previous** 1>------ Build started: Project: TESTERPROJ, Configuration: Debug Win32 ------ 1> blank.c 1>c:\users\pauline medwinter\documents\visual studio 2012\projects\testerproj\testerproj\blank.c(33): error C2122: 'long' : …

Member Avatar for Moschops
0
349
Member Avatar for wollacott

N 10*N 100*N 1000* N 1 10 100 1000 2 20 200 2000 3 30 300 3000 4 40 400 4000 5 50 500 5000 6 60 600 6000 7 70 700 7000 8 80 800 8000 9 90 900 9000 10 100 1000 10000 Hi, [code=c] #include<stdio.h> int main() …

Member Avatar for Ancient Dragon
0
625
Member Avatar for dewdropz

Hi I am looking for some information regarding VT102 escape codes. Are there any tutorials on this anyone can recommend? Basically, what I need to do is overwrite these print statements within the for loop to my screen: for (int i=0;i<5;i++) { printf("Enter the current price of the product: "); …

Member Avatar for rubberman
0
221
Member Avatar for numbplum

A 4 byte float has the value: 0x7F800000. Its value as a floating point number is: a. -39.482 b. +0.0 c. 11.0 d. +Infinity Hey there, I was hoping to solve another problem but I need help. I was wondering how I would convert the value to the desired answer? …

Member Avatar for rubberman
0
180
Member Avatar for Learningvinit

I ran same code linux and HP platform And the result stored was different. I found that the boundar for comparison is 255. It can be more undersstood from the below code. #include <stdio.h> int main() { FILE *fp=fopen("linux2.txt","wb"); int a = 100; int c=0; int i=0; for (i=0; i …

Member Avatar for Learningvinit
0
173
Member Avatar for Learningvinit

Hi All, While running a piece of code on Linux and HP i found the differenc in the result. Can Anyone Explain Why it is giving different results? #include <stdio.h> int main() { int a = 0; int b = 30030; int c = 34094; int d = 0 ; …

Member Avatar for Learningvinit
0
589
Member Avatar for dewdropz

Hi I have data in the following format that I need to write to a csv file. Student1 Mark1 Mark2 Mark3 Mark4 Mark5 Student2 Mark1 Mark2 Mark3 Mark4 Mark5 Student3 Mark1 Mark2 Mark3 Mark4 Mark5 Student4 Mark1 Mark2 Mark3 Mark4 Mark5 Student5 Mark1 Mark2 Mark3 Mark4 Mark5 I am writing …

Member Avatar for Ancient Dragon
0
207
Member Avatar for hitro456

Hi All, I have a binary search tree (consider following structure). struct bst { void *value; struct bst *left, *right; }; I want to save this unbalanced binary search tree in a file. And when I read this file, I don't want to recreate the tree from these nodes. So …

Member Avatar for rubberman
0
607
Member Avatar for fyra

Hi guys and gals. How can I find write or open for example? I tried man write and man open but those were not the pages I was looking for.

Member Avatar for rubberman
0
120
Member Avatar for anumash

I am trying to parse the FAT filesystem & I notice that many of the fields are more than 2 bytes. I was reading someone's program and he has defined unsigned short for a given field of 2 bytes. Now, my question is how does the compiler handle endianness? If …

Member Avatar for rubberman
0
146
Member Avatar for hg_fs2002

Is it possible to use tilde (~) in C preprocess directive in the following way? #define a 1 #if ~a==0 ... #endif Generally, I want to know how we can ~ in preprocessor directives?

Member Avatar for deceptikon
0
233
Member Avatar for fyra

Hi people. I'm trying to run whoami using execv but I'm getting a problem: --- CHILD PROCESS --- child PID: 3146 parent PID: 3145 execv: Permission denied child exit code: 1 I already have certified myself that I have run permission for whoami for all users. I don't know what …

Member Avatar for rubberman
0
7K
Member Avatar for ashish2expert

Hi, In the following program i have not defined <stdlib.h> header and included rand() function and it works without this header. How? #include <stdio.h> #include <stdbool.h> #include <time.h> #define NUM_SUITS 4 #define NUM_RANKS 13 int main(void) { bool in_hand[NUM_SUITS][NUM_RANKS] = {false}; int num_cards, rank, suit; const char rank_code[] = {'2', …

Member Avatar for vegaseat
0
520
Member Avatar for MiTiM

I want to create binary tree. With this program I wrote I have some problems. It seems the element I added to the tree is always added to the root place! Adding never happens to the left or the right subtree. This thing is prooved by result I always get …

Member Avatar for MiTiM
0
308
Member Avatar for aazamsajid

i want seprate 1234 like 1,2,3,4 when i give 1234 then this code works fine but if i give long int like 34545666 this code does not work. int main() { clrscr(); int num,r,c,sp,x; printf("enter number"); scanf("%d",&num); while(num!=0) { x=num%10; printf("%d",x); num=num/10; }

Member Avatar for deceptikon
0
154
Member Avatar for anandhakrishna

Guys, Am trying to open a file and read the content in that using C from mainframes. Here is the code, #include<stdio.h> int main() { int i; FILE *fp1; fp1=fopen("**********.CPP.SAVE","w"); if(fp1==NULL)return; for(i=0;i<256;i++) { fprintf(fp1,"%c",i); } fclose(fp1); return 0; else { printf("File does not exist"); } } Only the else part …

Member Avatar for totalwar235
0
286
Member Avatar for jjslama

I'm a student. My code is skipping over my printString function when I run it. Pardon the poor spacing. #include <stdio.h> #include <string.h> #include <stdlib.h> char * reverseString(char * original); void printString(char * string); int main() { char a[] = "this is a test \0"; char * b = a; …

Member Avatar for jjslama
0
110
Member Avatar for Asif_NSU

I wrote this code that checks whether a number is prime or not. It returns 1 if the number is prime or 0 otherwise. U just look at the bottom of the code... [CODE]#include<stdio.h> #include<conio.h> #include<assert.h> int is_prime(int n); void main(void) { int n=0; clrscr(); printf("An integer "); scanf("%d",&n); assert(n …

Member Avatar for Djoooleee
1
4K
Member Avatar for Sonia11

Hello experts, I have this code which works so perfect while detecting square objects from images which are downloaded from internet. However, when I am taking the image of a square object from my webcam and processing, its not turning out to be as expected. I am suspecting, the reason …

Member Avatar for deceptikon
0
103
Member Avatar for Gaiety

Hi , I am trying for a program which takes any no of characters as input and stores, so obviously i would need DMA. My approch is to Take a buffer of some fixed size(5 in this case) Fill the buffer till the fixedsize-1 Allocate memory dynamically and store the …

Member Avatar for Gaiety
0
149
Member Avatar for ashish2expert

Hi, I have a problem that wants to be calculated only by while loop. (no other loop, no goto, break) Develop a program that will input the miles driven and gallons used for each tankful. The program should calculate and display the miles per gallon obtained for each tankful. After …

Member Avatar for ashish2expert
0
3K

The End.