15,550 Topics

Member Avatar for
Member Avatar for rithish

#include <stdio.h> #include <stdlib.h> void main() { int a[400],n,i; printf("enter the no of elements: "); scanf("%d",&n); printf("enter the no: "); for(i=0;i<n;i++) { scanf("%d",&a[i]); } n=n+1; printf("enter the no: "); scanf("%d",a[n]); for(i=0;i<n;i++) { printf("%d",a[i]); } } i inserted elements after that i again inserted its not working.it shows 0 errors but …

Member Avatar for sfuo
0
86
Member Avatar for hackit

I am learning C. After completing the common core part. I found this unique program which will allow the user to create his own format specifier which will use "%b" as format specifier to convert a integer directly into binary. I want to know more about this code. How it …

Member Avatar for lil_bit
0
392
Member Avatar for salohcin

i having problem saving a txt file and printing it back out , i have the hints of using fgets(v[i],14,infile); and sscanf(v[i],"%d: %s %s,%x"%line_num[i],inst[i],reg[2],reg2[0]); i have no idea on how to imply this correctly can someone show me a correct implemtation of the code so i can move forward to …

Member Avatar for salohcin
0
208
Member Avatar for I_m_rude

int main() { float i=0.3; ....... ........ if(i<0.3) printf("ishq\n"); else printf("hello\n"); return 0; } hi, can anyone please explain why i am getting output as "ishq" even if i=0.3 so if condition must be false. pleas help i am not getting it. thanks.

Member Avatar for Banfa
0
201
Member Avatar for musicman432

So I'm trying to write this program in C that will take a message the user types in and encrypt it using an RSA public key that the user supplies. I know there are encryption functions and libraries in C but I want to actually recreate the algorithm in code …

Member Avatar for sccdqx
0
294
Member Avatar for ricardo.crudo

This below code is the code minimized of real code. Is posible synchronize a global variable with pthread and main while(1)? On the below code, the printf not apper in order and delayed of the 1 second. #include <pthread.h> #include <stdio.h> pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; int teste; void *ThreadFunc(void *arg) …

Member Avatar for L7Sqr
0
212
Member Avatar for Rubinder singh

I need a code which can solve the equations like this :- 56*78+(78/8) In this we know that brackets must be solved first and then divide/multiply and then add/subtract. So, i need a code for solving this kind of equations which contains multiple operators in single line. Thnks :)

Member Avatar for Rouf mir
0
298
Member Avatar for on93
Member Avatar for Tajinderpal
0
227
Member Avatar for I_m_rude

hi, My question is about the const keyword. union emp { char name[]; int age; float salary; }; const union emp e1; int main() { strcpy(e1.name,"H"); printf("%s",e1.name); e1.age=45; printf("%d",e1.age); printf("%f\n",e1.salary); return 0; } I know this code has error which is that "cannot modify constant objects". But Can anyone tell …

Member Avatar for I_m_rude
0
133
Member Avatar for I_m_rude

hi, int a[][2]={1,2,3,4}; int *p[]={(int*)a,(int*)a+1, (int*)a+2}; for(i=0;i<2;i++) for(j=0;j<2;j++) printf("%d ",*(*(p+i)+j)); Firstly, This is part of any code. And i want to ask that in *p[] definition, why it is written (int*) with every element since a is already an pointer. Secondly, when I am accessing *(*(p+1)+1) element in loop, then …

Member Avatar for I_m_rude
0
123
Member Avatar for Vish0203

How to define multiple characters using macros?? I want to declare all the hexadecimal digits under a name "hexa". Does anyone know it how to do that?? The below code is wrong! Any suggestions to make it correct?? #define hexa 'A','B','C','D','E','F','0','1','2','3','4','5','6','7','8','9' #include<stdio.h> int main() { char a; printf("Enter a character= …

Member Avatar for Vish0203
0
135
Member Avatar for shanki himanshu

Why the program is running without line 14? #include<stdio.h> #include<iostream> //#include<conio.h> //#include<math.h> #define FOR(i,a,b) for(int i=a;i<b;i++) using namespace std; int main() { int a[]={1,2,3,4,5,6,7,8,9,10}; int *b; //b=(int *) malloc(sizeof(a)); b=a; //cout<<b; FOR(i,0,10) cout<<b[i]<<" "; //cout<<sizeof(b); //getch(); return 0; }

Member Avatar for shanki himanshu
0
97
Member Avatar for joey_r

Hey ya'll I was looking for some guidance. I'm building a "workout generator" for fun and got stuck. I want my program pick a random assortment of exercises and write them to a new file. What is the best way to randomly pick strings from a list of exercises; jump …

Member Avatar for joey_r
0
85
Member Avatar for I_m_rude

hello, I am learning C from past 1 year, Now, I want to improve my coding skills by learning techniques like dynamic programming, backtracking and all that stuff. Can u please tell me or give me links from where i can learn, practise and improve these skills ? please help …

Member Avatar for I_m_rude
0
105
Member Avatar for laavanya

what kind of concepts must be taken up for mini projects by students,especially for their first project...??please reply...

Member Avatar for laavanya
0
208
Member Avatar for XodoX

I'm having difficulties writing the rpc function. Specifically, I don't know how to pack a function name and input argument into a message body, send the message, set and unpack reply, and return result and error code. I know how to create the socket, request aconnection from the server etc. …

Member Avatar for XodoX
0
162
Member Avatar for rithish

i would like to start data structures in c langauage.but i dont know even what is data structure and 0% about data structure.can u suggest me some books for data structure in c?????

Member Avatar for rubberman
0
113
Member Avatar for cse.avinash

I am doing following code to get the output upto 5 decimal characters of any number inputted by user when divided by 1, I have to use typecast it with (float) , can any one tell me how this can be done without typecasting or using float constant.. int main() …

Member Avatar for cse.avinash
1
178
Member Avatar for Dave Sinkula

While not terribly difficult, first timers may not know the functions to look up and use. Here is some basic code for reading a file one line at a time. The contents of the file are printed to the stdout.

Member Avatar for 'CoffeeLike
2
61K
Member Avatar for Vish0203

I have a problem, actually I want the software i created, to be little private. Hence, I thought of using MAC address, but I'm Unable to retrive the MAC address using C. I surfed on the internet and found the code to retrieve MAC address in LINUX, but i want …

Member Avatar for gregha04756
0
66
Member Avatar for hackit

I want to learn how to use preprocessor #pragma in C? can anyone please help me to understand..

Member Avatar for Ancient Dragon
0
96
Member Avatar for ashine80
Member Avatar for sandeepalankar

Hi, I have a problem in data structures I am stuck in this one .Please try to help me. Question : A man Joe has a habbit of eating pancakes & driving bikes.Once he went for outside by his bike,now he is EXACTLY IN THE MIDDLE OF A ROAD his …

Member Avatar for WaltP
0
176
Member Avatar for gem.gonzales.9

Please help me to make a program in turbo c that will let you guess the password. but if it is wrong the program will ask you do you want to continue y or n ,if y it will display again what is the password if no end the program

Member Avatar for WaltP
0
156
Member Avatar for I_m_rude

hi, 1. actually i was reading some text from my book and i come across this expression. I am not getting what it means. here it goes, typedef int (*HIG) (int,int); And "sizeof" can't be used in #if because the preprocessor does not parse type names. What this statement means …

Member Avatar for Perry31
0
112
Member Avatar for rajshrimohanks

I came across [this](http://www.daniweb.com/software-development/cpp/threads/189901/screen-capture-program) program in the C++ section. How to do something similar in C? Let me elaborate. I want to read the colour values of individual pixels in at the rate of at least about 25Hz. I have a nVidia GeForce GTS450 graphic card and Windows 7 64-bit/Linux …

Member Avatar for rajshrimohanks
0
2K
Member Avatar for iamnot

Sample Input: 20 10 2 5 2 Sample Output: 2 Explanation: An amount of 20 could be made in 2 ways: 10*2 10*1 + 5*2 I want to find out the number of ways a particular amount can be made with given coins.In the sample input 20 is the amount …

Member Avatar for sepp2k
0
135
Member Avatar for benjaminpelc

Hi, I am trying to write code to read a text file containing velocity vector data in the form x, y, u, v. An example of the data file I am opening is: 0 1.0 3.24 45.64 1.5 2.5 54.34 23.45 ... I have a function which can read the …

Member Avatar for benjaminpelc
0
270
Member Avatar for RReddy1

Hi, Can anyone help me out in the below issue. My requirement is,,i have to take an xl sheet as input in the program with 2 columns student name,student address and some 20 number of rows for each column. i have to take another input file also i.e a log …

Member Avatar for Perry31
0
83
Member Avatar for BHKK

Hi, I got a problem in reading and write on file. I have to create an virtual agenda, therefore I enter a name and a number for N persons. After entering the infos if the file doesn't exist, the program create it and save the infos, if the file exist …

Member Avatar for Ancient Dragon
0
172

The End.