15,551 Topics
| |
sorting in array, i'm stuck understand that why we've used a 'j' loop here ? can anybody explain ? and why we are checking this condition ? [iCODE] if(num[i]>num[j])[/iCODE] [CODE]int main(void) { int num[5],temp; int i,j; for(i=0;i<5;i++) { printf("Enter Value for %d",i); scanf("%d",&num[i]); } for(i=0;i<5;i++) { for (j=0;j<5;j++) { if(num[i]>num[j]) … | |
[code=c] #include<stdio.h> #include<conio.h> void main() { int a[] = {10,20,30,40,50},j,*p; clrscr(); for(j=0;j<5;j++) { printf("%d",*a); a++;/*here compiler error "lvalue required"*/ } p=a; for(j=0;j<5;j++) { printf("%d",*p); p++; } getch(); } [/code] i used turbo c++ compiler.and save this programme as abc.c why this type of errors occur? | |
Hi i know this may sound a bit silly but i have looked through some websites but can't really find exactly what the difference is between "=" and "==" For example [CODE]if(x==0) execl(“/bin/ps”, “ps”,”-eal”,NULL)[/CODE] how is that different from [CODE]if(x=0) execl(“/bin/ps”, “ps”,”-eal”,NULL)[/CODE] thanks | |
Write a C program using do while to find and print the average of three exam results of a student that will entered as an input from the keyboard. It repeats as many times as the user wishes. The program will ask for entering new entry (student grades) confirmation and … | |
I am trying to read a file and place the contents in various arrays. The fields are seperated by commas. I have fields that are strings, doubles, and integers. The string fields may contain characters such as ",&:. The double fields may not all be populated but I need to … | |
Hey is their a standard library that gives false and true values or something or are you suppose to assign them?? Im writing a function that suppose to return true or false. And i also tried replacing the words true and false by !0 (true) and 0 (false) but my … | |
I am very much a beginner and trying to create a linked list, asking the "user" to input 5 or 6 values. My problem is that I don't know the correct terminology or how to store the user's input so that I can create my pointer to the next value … | |
how do I go about adding a row to a column in simple code? and then printing out the results. | |
i am using linux and C as programming language. I want to display list of time zones to the user. How can i have list of all time zones in C. Also how can i get time zone of my system? | |
Why the compiler is generating the sentence, Lvalue required. what is the meaning | |
I am trying to create a game and tried compiling my program with my makefile, but I keep getting an error stating that there is something wrong in main. I can't seem to find the error, but this is how my main looks like: [CODE]#include "tfdef.h" #include "movement.h" #include "game_utils.h" … | |
[CODE]int sin2(int g) { static int metritis1=1,i=0; int l,c,pin[100],pin2[100]; char result; srand ( time(NULL) ); l = rand() % 10; c = rand() % 10; c=65+c; l=l+1; pin[g]=c; pin2[g]=l; printf("%d and %d the g is %d\n",pin[g],pin2[g],g); while (1){ if (pin[i]==pin[g] && pin2[i]==pin2[g]){ printf("%c kai %d g is %d to i … | |
Efficient code for extracting unique elements from sorted array. Time Complexity is O(n) | |
Thanks in advance for any help I can get. This is a que I need to add in to another program. It is almost straight out of the book, and a lot like my working stack implementation. It steps through correctly when I go line by line, but I'm not … | |
char *default message[]="hghgghjgh" char *message=defaultmessage tis line showing error as 'initializing':cannot convert from 'const char[ 9] to 'char *[]' can u help me....? | |
Hi.I write a program in C for my microcontroller(PIC 18F452) but faced to a problem that related only to C language and that is; as you can see in my Main program and the two Functions I want to pass an array of ; " int adcvalmax[8] " which got … | |
Hi , I am preparing a project in C using mouse handling. I have no idea as to how input(text) taken by user in a graphics mode. Kindly help | |
Hi, i have written a program to find the power of two numbers using iteration. The problem here is that to return the correct out put for even powers but not for odd powers. b = base , e = expo ,p= power( b, e);; for even powers the statements … | |
[CODE]#include <stdio.h> #include <stdlib.h> typedef struct { int finalMark; /* Ï ãåíéêüò âáèìüò ãéá çï ìÜèçìá */ }StudentType; struct var { StudentType *aStudent; char onomaa[20]; char eponimoa[20]; }; typedef struct var newtype; newtype a; main() { int bathmos; char onoma[20]; scanf("%s",&onoma); strcpy(a.onomaa,onoma); printf("%s",a.onomaa); system("pause"); scanf("%d",bathmos); strcpy(a.aStudent->finalMark,bathmos); printf("%d",a.aStudent->finalMark); system("pause"); }[/CODE] this … | |
I have to write a program where the producer gets the some number of inputs from the user and the consumer takes from the shared memory and prints their squares.In my program i have the shared memory size as 5. my program works perfectly in the area that producer and … | |
I'm writing a program of Conway's Game of Life. I think I've figured out most of it but there something wrong with the rules I've set up [CODE=c]for(row=0;row<20;row++) { for(col=0;col<21;col++) { n=0; if (a[row][col]=='*') { if(a[row-1][col-1]=='*') { n++; } if(a[row-1][col]=='*') { n++; } if(a[row-1][col+1]=='*') { n++; } if(a[row][col-1]=='*') { n++; … | |
Hello, As of right now I'm in a hard spot. You see at this moment, I've been programming both my client and server. And everything was working very well, until I realized something. The fact that in my client I have multiple threads running and sending data to my server … | |
I didn't know where to put this but this seemed to be the best place. I took an internship this summer and found out that I will be doing embedded development in C/C++ and Linux for phones(land line voip stuff). This is bad for me since I have always been … | |
I am trying to create a program that reads a data file and computes the water usage for each hour of the day, the average hourly usage for the day, and the time of the highest hourly usage. I already created the main program, and two other functions, along with … | |
Hello. I would very much appreciate if someone would aid me with a hint. My problem is as follows : read two arrays of chars and merge them into a third array like so : ARR1 :123abc ARR2: rt678iogl ARR3:1r2t36a7b8ciogl The problem must be solved without pointers and string.h Basically … | |
Hi, [CODE] #include<stdio.h> int main( void ) { float a = 0.2; if( a > 0.2 ) printf( "\n a is greater than 0.2" ); else if( a < 0.2 ) printf( "\n a is less than 0.2" ); else printf( "\n a is equal to 0.2" ); return 0; … | |
Hi I want c language code to open my web browser (IE or Firefox) and close it after 2 min. can any one help me?? please i need it. | |
I have a question, well more of a verification. In the program below, I'm packing a character array with some values. The first two are unsigned integers the next is a function pointer and the final is a string of characters...Now my question, is the casting correct for the function … | |
[CODE] /* ** showip.c -- show IP addresses for a host given on the command line */ #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <arpa/inet.h> int main(int argc, char *argv[]) { struct addrinfo hints, *res, *p; int status; char ipstr[INET6_ADDRSTRLEN]; if (argc != 2) { fprintf(stderr,"usage: … | |
Hello, this forum is for asking the required code and logic behind implementing the "factorial program - i.e. finding factorial of any big number"---could someone help me out???/ |
The End.