519 Posted Topics
Re: After inputting the data, should you not create a separate for loop from 0.. 360 for that increment stuff ? | |
Re: @Walt Quick question, the condition in the while loop will use arithmetic and relational operators right ? Or is there any way to write the while loop condition? | |
Re: Also I notice that the loc variable used in while loop in the quick sort is not initialized. | |
Re: Can you please explain your problem more concisely .... | |
Re: Quick question AD, which hardware does groups 4 bits into a byte ? | |
Re: Quick question, What is the data that you are trying to store in the stack ? 1's or the content b/w the < .... > tags ? If you going to store just 1's then your program will break for [CODE] <html> <a> My text </b> </xml>[/CODE] Storing the content … | |
Re: @L7Sqr the pattern is that you alternatively add 1 , then add 2 and so on ... @OP Please provide more info about the problem statement and post your coding efforts | |
Re: This should help you get started for each suite i: 1...4 for each card j:1 ... 13 // Now set the properties for the card | |
Re: There is a functional called itoa which can convert int into strings | |
Re: @moroccanplaya Gerard is opening the file in r mode while you are opening the file in rb mode. Could this be an issue ? | |
Re: Can you please give an example of the expected Output and the output that you are getting ? | |
Re: What is your question ? By the way from the code you have posted I suggest you look at a tutorial on the concept of arrays | |
Re: Further clarifying gerard's post uint16_t is a data type ..Kind of like int / char ... | |
Re: 1. Take the input from the user into a string called input 2. Use string length to go to the end of the string. 3a. Start iterating towards the start of the string. When you hit the space char, then stop. Store the chars that you iterated over into a … | |
Hi All, First of all let me start by saying I love Daniweb and I try to take time out everyday to answer the questions that are posted in the various forums. But I am often on the move which means I have to follow the chains of messages in … | |
Re: You should first try to write a string matching algorithm . If the longer strings contains the smaller string in many places, can you successfully print the locations of the sub string in the main string ? | |
Re: Also you cannot use variables as case numbers in a switch statement. It has to be to contants Check out [URL="http://www.google.com/search?client=ubuntu&channel=fs&q=c+switch&ie=utf-8&oe=utf-8"]this[/URL] link | |
Hello Everybody, I have a small confusion with regards to pointers. Here is some code [CODE] int main() { int *p1 = (int*)malloc(sizeof(int)); *p1 = 10; printf("The number is %d",*(char*)p1); }[/CODE] I run the code and the O/p is 10. My question is, is there no difference in using char … | |
Re: Do something of this sort for inducing delay 1. Create a thread to run in the background. Let this thread call function f1() when it wakes up. int flag = 0; int main() { // Create a thread to run in the background. Let this thread call f1() int numberOfThreads … | |
Re: Some pseudo code [CODE]while(true) { // Take the I/P from the user // Check if the first row has all X's // Check if the second row has all X's .... ... // CHeck for all rows, all columns, diagonally for X's and 0's }[/CODE] | |
Re: Just a thought ... I think this might help you ... When you use a file for storing data you cannot just update a single line of text in that file. You have to read the entire file into memory, make the changes that you want in the memory and … | |
Re: Quick question ... Is the third parameter in the equal function a default parameter ? | |
Re: There are 2 concepts involved here Concept 1: In a Binary Search tree if you print all of the nodes inorder then the output will be an array sorted in ascending order. Extending this to your problem, you can use the last name as an index for inserting data into … | |
Re: Check [URL="http://www.google.com/search?client=ubuntu&channel=fs&q=c+spiral+matrix&ie=utf-8&oe=utf-8"]this[/URL] out | |
Re: If you dont want to implement your own sorting function then check out [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/"]this[/URL] link. PS I know this link is from a C++ reference, but I think it will work in c code as well. Others please correct me if I am wrong | |
Re: The error on line 52 is that you cannot use string as a name of a variable ... I think the keyword string is reserved. If you notice it got high lighted when you pasted the code here Also why are you doing an operation inside the print function ? | |
Re: When you create the consumer thread, check the function call. The last parameter is s . It should be &i | |
Re: Some of the functions you might need strtok --> Use this function to split a string into a series of words strcmp --> Check if this word is a name or a period | |
Re: In the if ... else block you have used the variable total twice. I think you meant to use totalPoints in one of the places ... Also if I am using 2 conditions separated by a logical operator in an if statement trying I write it like this [CODE]if ( … | |
Re: @rohan I think, theoretically speaking the approach described by Walt is faster than your approach Walt's Approach Read the entire file to find the size of the file --> O(n) Alloc a buffer of size n and copy the contents of the file in buffer --> O(n) `O(n) + O(n) … | |
Re: [QUOTE=ankithajain1989;1338019]i want pascal triangle code i am a beginner doing my m.c.a[/QUOTE] If I am not wrong MCA is a post graduate degree right ? If it is indeed a post graduate degree then its high time you started writing your own code | |
Re: String reverse without using additional space 1. Use strlen (or write your own function) to calculate the length of the string 2. x= strlen /2 3. from 0 to x, interchange the positions of the first and last, second and second last .... and so on | |
Re: Small hint if you are totally stuck ... Use for loops My personal advise is first try to sum up all the values in an array, then go for higher dimensions | |
Re: If you want to make your own string comparison function 1. If length of string 1 is not equal to string 2 then, strings are not identical 2. for i:0, to strlen, check if the str1[i] == str2[i]. If they are not equal then break out of the loop | |
Re: Is there any max size to the titles ? Is there any way to determine how many titles are going to come in ? Instead of a 2d array how about a linked list of structs ? | |
Re: Quick question were you looking for a mathematical solution or a programming kinda solution like the one described above ? | |
Re: I really like "Let us C" by Yashwant Kanetkar This book assumes no previous knowledge of programming and teaches C programming in a very step step and methodical manner | |
Re: What kind of error are you getting ? Did you include all the header files ? | |
Re: [URL="http://en.wikipedia.org/wiki/Internet_bot"]This[/URL] gives general information about bots I am not entirely convinced if you need this information for destructive or constructive purposes so I will not give any further information. If you are really interested in this topic then google will be your best friend in this endeavor | |
Re: In your while loop (lines 36 - 39) you are not checking to see if you hit NULL or not WHen you do current = current->next check to see current->next is not equal to NULL | |
Re: This is how I would approach this problem Suppose I have to remove the string "tes" from United States of America 1. Check to see if I can find a t any where in United states of America 2. If do find a t then check for e and then … | |
Re: Do a google search for "implement my own strstr function" you will find lots of suggestions | |
Re: Check out this piece of code [CODE] int main() { char arr[10]; //Max i/p size is 10 ie 9 letter and \0 char* p = NULL; printf("Enter your name \n"); fgets(arr,10,stdin) ; //stdin is standard input // If the user enters 9 or less chars then the first 10 chars … | |
Re: Check out [URL="http://www.daniweb.com/forums/thread6713.html"]this[/URL] thread | |
Re: Is the format of the input file pre defined or can it change If the input file format is not fixed then this is a hard problem | |
Re: Write your accept function this way I have separated the data input and the smallest number calculation into 2 steps but you dont have to [CODE]void accept(int *a) { int size =0,i=0; printf("Enter the size of the array\n"); scanf("%d",&size); a = (int*)malloc(sizeof(int)*size); // Size of the i/p array is dynamic … | |
| |
Re: If you want to use pointers to pass a 2-D array write your code like this [CODE] void printStuff(int* a,int rows,int cols) { int i=0,j=0; for(i=0;i<rows;i++) { for(j=0;j<cols;j++) printf("%d\t",a[(i*rows) + j]); } } int main(int argc, char *argv[]) { int a[3][3]; int i=0,j=0,count=0; for(i=0;i<3;i++) { for(j=0;j<3;j++) a[i][j] = count++; } … |
The End.