15,551 Topics
| |
[code=c] #include<stdio.h> #include<stdlib.h> main() { char a[32],*a1,b[64],*b1; a1=&a[0]; b1=&b[0]; a1="hellohellohellohellohellohello" ; printf("\n contents of a1: %s\n",a1); int i =0; for(i=0;i<=31;i++) { printf("%c",a[i]); } } [/code] So why does printf ("%s",a1) work correctly while printf("%c",a[i]) display junk ? Since a1 points to a[0], shouldn'it it display the same values ? | |
hi guys, I have a simple question and I am new to c, Would appreciate any advise I could get. Here's the doubt. [code=c] main() { char a[10],*a1,b[10],*b1; a1=&a[0]; b1=&b[0]; int x=0; for (x=0;x<=1-;x++0) { *a1++=*b1++; } } [/code] Basically if I had a string in b[10] it would get … | |
Hi, Can you plz help me in creating a file in C having columns rec_id (int), score (float), hour (int), no_clicks (int) with rec_id values ranging from 1 to 100, score values initialized to 0.11, hour values initialized to 0 and no_clicks values also initialized to 0. And then generating … | |
how can you make program using a linked list that displays your outputs in ascending alphabetical order? we are only allowed to use: #include<stdio.h> #include<conio.h> #include<stdlib.h> #include<string.h> TIA | |
hai ia have been try this but i didnt get any output on my run window. #include<process.h> main() { system("echo hello"); } [B] consider me[/B] | |
Hi have a problem, this code should read a file and then save it in a linked list, just the <uid><name> from a lie looking like: <username>:<password>:<uid>:<gid>:<fullname>:<home dir>:<shell> I can't find the segmentation fault error atm, but hints on the code would be helpfull. Atfer the insert in user list … | |
Hey everyone, I am supposed to write a program that counts the number of vowels in string of characters. It must include "Struct counter_t (it must be declared as in the code i've written)" and function "int CountVowels (IN text[], OUT Count)". the OUT parameter must be of type counter_t. … | |
Hi!!! This is my first time to post here and I have a problem and I want your help..... This is the case my teacher gave me a question to add 1 to 100 using while loop and its really confusing me... but here is my idea and I jsut … | |
[CODE=C]#include<stdio.h> #include<conio.h> int main() { float a=0.7; if(a<0.7) printf("C"); else printf("C++"); getch(); return 0; }[/CODE] The above code prints 'C'. Whereas the following two codes prints 'C++'. Why is that? [CODE=C]#include<stdio.h> #include<conio.h> int main() { float a=0.7; if(a>0.7) printf("C"); else printf("C++"); getch(); return 0; }[/CODE] [CODE=C]#include<stdio.h> #include<conio.h> int main() { … | |
Hi! I'm just having a problem in displaying strings of line in the command prompt. My program is to search a string and enclose it with three asterisks both sides. Though it's functioning... But the problem is the program show only those lines where the strings are present. Thr program … | |
Hi All, Please help with the below Valet Parking Problem. Let me know if you need more info. The valet parking problem: Some fancy restaurants (i.e. ones without a drive-through window) offer a valet parking service with which one of the restaurant's employees will park your car for you as … | |
Hi! My code is to search for the strings. Example when you type srtool.exe -s in -f sample.txt (in the command prompt), all the words containing "in" will be changed to ***in*** My problem is all words containing in will change to ** (one asterisk per word) instead of ***in*** … | |
I am very confused how to write a function which can accept 3 input parameter to calculate sum and average.the sum and average should be returned through output parameter ... pls help ..thx | |
hi, I am developing an application in Windows CE platform is Windows Ce .net 4.2. i need to play media file through C code, i have managed to play media file in win32 through "system" command but this command is not available for Windows CE, i have tried CreateProcess function … | |
hi all, I want to convert a string contain hex format '0x15' and what to convert it integer because i want to write data contain by a integer variable in hex format (binary data) into the file. here is my code [code=c] char * str = "0x15"; int value; FILE … | |
Basicly i tried to do address book but i guest it not work at all..can i know where i get wrong or any advise?.. | |
How to create an initialised list and delete any node from the list using C language.Please help me.I need it urgently. | |
good day, i rily nid help on something.... its about gotoxy in turbo c... 1st of all, can u use gotoxy in turbo c? (c++ 6.0) 2nd, if u can... can i ask how to use it? please help me... im just a beginner... lol.... h0pe u c0uld help me... … | |
hi all i want the code for reversing a string eg : I live in india Ans India in live i | |
Hello everyone, I don't know what is the exact name to call this, so I call based on what I want to do in my program. Its operation got something similar to chat server and client. I have server and client application. Firstly, when one client connects to server and … | |
How to initialise a sorted list and after inserting any node the resultant list also becomes sorted.Pls help.I need it urgently. | |
So I'm messing with some code, trying to get more familiar with string functions, and I stumbled into an apparent error on my part. Here is my code: [CODE]#include <stdio.h> #include <string.h> int main(void) { int len = 0; char *str = "This is a string"; char ch = '\0'; … | |
i need to write a program that is acting as a simple personal address book with the record of name,email and phone numbers. The range of function should have: searching existing records. adding new records. deleting existing records. i need to include the last update date and time of the … | |
I am supposed to rewrite the code below to "compute the number of digits to any base(such as base 2, base 16, base 8)." Just wondering if any of you can provide any explanation or pseudocode on how to go about doing this? Thanks for any help you can give … | |
I am working on a code which opens a file (infile), copies it to an output file (outfile) and then asks the user for a string and searches for that string in the outfile and replaces every occurence of that string with & symbol. Here's an example: Contents of infile: … | |
I'm a IT newbie...one day a CST student asked me whether there is any way to write something at a particular location or not.....so am forwarding it to you all. Please guys help me.. | |
I had gotten my code all working, and everything is capable of doing what it's supposed to do. The next step for me was to organize it a little better; re-allocating my definitions to different source code files and that such...and there the problem starts. After declaring three dyanamic link … | |
how to add and delete record of contact in address book??? i'm using void searchContact(void) to search the contact and i have done it but i don't know how to proceed. i'm trying to use void addContact(void) {} void deleteContact(void) {} to do but i really don't know how to … | |
so far i already reach this line, but what make it pain in the ass is, i can't really seem to solve [B]how to make multiple operation in one execution[/B], i can only manage make it one operation in time, some say i have to [B]convert the operation like "1.22*3+2.1" … | |
Can anybody help me to do this program ? Problem is to write a program which will take another program as a input & it'll give a program flow chart. Ability of processing loops and if-else block would suffice. I can't understand where to start. |
The End.