- Upvotes Received
- 5
- Posts with Upvotes
- 5
- Upvoting Members
- 4
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
Developer, Engineer, Embedded Developer
- Interests
- Programming, Embedded System, Linux opensource Driver Developments, Computer Games, Chess Engines
- PC Specs
- Macbook Pro retina 13.3', Debian 7.7 Home PC quad-core AMD, 8 GB, 500GB
27 Posted Topics
I have inputs in the form like below Data: 01 18 01 23 45 67 89 AB CD EF FE DC BA 98 76 54 32 10 01 23 45 67 89 AB CD EF 02 18 67 89 AB CD EF FE DC BA 98 76 54 32 10 … | |
I have a text file in the form like below sourceFiles { hello.cpp, hi.cpp, main.cpp, } headerFiles { hello.h, hi.h, } path { source [ what, how, which, ] header [ include, inc, head, ] } I need to populate several lists from this text file. So far I have … | |
I have a small snippet. It is related with several malloc statements. Can somebody please explain. #include <stdio.h> #include <stdlib.h> int main(){ char* ptr1 = (char*)malloc(10); free(ptr1); char* ptr2 = (char*)malloc(10); free(ptr1); char* ptr3 = (char*)malloc(10); free(ptr1); return 0; } **What will happen to the snippet..? Will the malloc for … | |
Re: 1. Implement vector library of C++ in C..USE ONLY integer DATATYPE **(Easy)** 2. Write the most efficient program to print Fibonacci values up to the value given during runtime and also store the values in a data structure to use it later..your code has to be very memory efficient and … | |
Can you please explain the reason of the garbage output instead of the each words in the string.. #include <stdio.h> #include <string.h> #include <stdlib.h> int count = 0; //char** memptr = NULL; char** push(char* word, char** memptr){ if(count > 1) memptr = (char**)realloc(memptr, (count * sizeof(char*)) ); memptr[count - 1] … | |
Re: Different compilers behave differently..Don't f#ck yourself up for something which depends on something called order of evaluation. [Click Here](http://en.cppreference.com/w/cpp/language/eval_order) give problems that are bit genuine | |
Re: The real essence of elegant programming is not to rely on order of evaluation..Moreover use gdb to debug the code by creting multiplr in-line breakpoint in the printf statement.. | |
Re: Use this logic.. Sorry this code is in python not in c...but you can understand the logic number = 123134254 reverse = 0 while number > 0: reverse = (reverse * 10) + (number % 10) number /= 10 b = 0 answer = 0 while reverse > 0: a … | |
I have made this code. It is working good. Can anyone please help me to make it more optimised? Here is the code. /* ∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑∑ Author: Mayukh Sarkar Email: mayukh2012@hotmail.com Country: India License: GPL public Copyright ® © ¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬ */ #include <stdio.h> #include <stdlib.h> static int size = 0; typedef … | |
Re: Please metion the error..Is it some runtime or compile time errors..If it is some run time error then plese check for the segmentation faults or if the the output is what you have desired or not. But if it has some compile error, gives us the line number. Your code … | |
Re: In the 1st option the answer can be fetched properly..of course you will have a lvalue error because you `++` & `=` operator is not arranged properly. Do this & check `(unsigned char*)dest++` and then `*((unsigned char *)dest) = c;` | |
Re: Firstly, Indent your code properly dude.. Secondly, if you are using c++, why using Link List, thats not the conventional C++ style..Use vector of class datatype instead of structure..Vector library provides several method to operate on the database. Lastly, Use these above mentioned principle to implement the homework by yourself. … | |
Re: You probably cannot do it because linking the function implementions are the part of the linker & not the compiler. The functions are implemented in the appropriate headers & when you include them, linker links those definitions..Once the execuatble is prepared, there is no way you can include those headers … | |
Re: First decide which encoding format you want..(WAV is the obvious choice always) Second read that how data is encoded in that format. Implement that encoding format in your C program Write data into a file in that encoded format from that C program & with .wav extention Finally write a … | |
Re: If you cannot use any C++ STL container, then what's the point of using c++ ? I would prefer vector insead of link list in c++ | |
Re: for C++ use `std::string a` instead. And instead of strlen use `a.size()`, to parse the data from the string, use `a.substr(int index, int noOfBytes)` | |
Re: You may do it anyway but internally when opcode is generated, it always takes a temp memory for temporary storage. Moreover memory overload problem can always create problem for two large numbers. Swapping two variables using a third variable is hence always better. | |
Re: By console color if you mean, the output of the code will be in different color then try this **file: color.h** #include <ostream> namespace Color { enum Code { FG_BLACK = 30, FG_RED = 31, FG_GREEN = 32, FG_YELLOW = 33, FG_BLUE = 34, FG_MAGENTA= 35, FG_CYAN = 36, FG_DEFAULT= … | |
Hello guys can anyone please help me in a problem relating to file. The problem is that I want to use `fgets` on a c file from another c file and increment a the counter every time to get the number of lines and I also want to put the … | |
Re: just type in the terminal `time EXE_NAME` and it will give you the runtime..the manpage of time looks like this TIME(1) BSD General Commands Manual TIME(1) NAME time -- time command execution SYNOPSIS time [-lp] utility DESCRIPTION The time utility executes and times utility. After the utility finishes, time writes … | |
Hey is there anybody who works with SDCC to make projects for 8051 microcontroller series on Macbook. If yes then can you please post the working make file, specially the part which loads the program in the device. I am confused what to write specifically with the program tag in … | |
Please explain when this error occurs.. duplicate symbol _Firstdata in: list.o main.o ld: 1 duplicate symbol for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) | |
I have a small program for Linklist in C.. ** linklist.h** // // linklist.h // LinkList // // Created by Mayukh Sarkar on 17/04/15. // Copyright (c) 2015 Mayukh Sarkar. All rights reserved. // #ifndef __LinkList__linklist__ #define __LinkList__linklist__ struct LinkList{ int Data; struct LinkList* NextData; }; struct LinkList *Firstdata = … | |
Why the following code is giving me an error like this `make: *** [all] Segmentation fault (core dumped)` the source code is like this #include <stdio.h> int main() { int i; char* ptr = NULL; *(ptr + 0) = 'H'; *(ptr + 1) = 'e'; *(ptr + 2) = 'l'; … | |
I have these files.. **str.h** #ifndef _str_h_ #define _str_h_ struct STRSTR { char* MainStr; char* SubStr; }; char* str_str(int, int, struct STRSTR* sample); void init(char*, struct STRSTR* sample); #endif /* _str_h_ */ **str.c** #include "str.h" #include <stdio.h> void init(char* str, struct STRSTR* sample){ sample->MainStr = str; } char* str_str(int index, … | |
**Okay this is my first post and I am quite excited that how it will be recieved by the community. I have a long experience in C++ programming but never been a part of any community hence I believe that as a tyro, my mistakes will be ignored.** This post … |
The End.