I have a C file that will be cross compiled in both Linux and Turbo C. It has segments of codes specific to each platform. I know that I will use #ifdef's, #define's to control which part will be...
Type: Posts; User: ozgulker
I have a C file that will be cross compiled in both Linux and Turbo C. It has segments of codes specific to each platform. I know that I will use #ifdef's, #define's to control which part will be...
PHP or ASP.NET?
Rams are by far the most powerful team and they will crush Patriots before they know what hit them.
For me, those in damned cable TV network cancelled the channel (FOX-Sports) which broadcasts...
Try this
Time::Time( int hr, int min, int sec, int bmonth, int bday, int byear)
: birthDate( bmonth, bday, byear )
{
setTime( hr, min, sec );
}
Well, if you are writing code just a couple of pages, yes you may not need an IDE. However when your code becomes dozens of pages and if you are programming in a multi user system, then no simple...
Machine independence of C is that you compile the same source code in different machines and get different assembler code specific to that type of machine.
So your source code is the same....
< third party ones.
Nearly all of the components of Linux are third party ones. So as long as you write for KDE or GNOME, you don't need to worry about it.
You use fork() and execve(and its derivatives) to run a program within a program.
Fork creates a copy of the current process and you overwrite the content of the child by an execve call.
[CODE]...
Apart from what gunfinguy4 has pointed, I see that your t is not initalized to anything. Also you don't seem to increment t in the while loop either.
I actually hate excessive use of preprocessor. I was looking at the source of linux kernel and saw stuff like that
in file zz.h
#include xx.h
#define _status (x) >> 1
in file xx.h
#define...
Hey guys, I want to know the features you are most annoyed in C/C++. (apart from segmentation faults) :)
I await your feedback.
Are you sure you are freeing the correct element? You have to free the deleted nodes because you want to claim the memory allocated to them. If you don't free the deleted elements, you will leak out...
use strcpy to allocate a string from another;
char *str1 = "something";
char *str2;
int size = strlen(str1) + 1;
str2 = (char*) malloc(size);
strcpy(str2, str1);
By the way, do you want...
It counts the occurences of 1's in the binary equývalent of an unsigned integer and returns 1 if the total number of 1's is odd, 0 for even.
Sources are usually compiled into library files (.lib) in commercial compilers and distrubuted with their headers so you cannot read the source.
However you may try yo search for an open source...
I am not sure whether fflush(stdin) is defined or undefined but I have used this hundreds of times in various compilers (with exception of gcc) and it is working. Is being undefined (if really)more...
I have corrected the mistakes and marked them on your code.
add fflush(stdin); after the scanfs.
#include <stdio.h>
main ()
{
char ans;
do
{
int num1, num2, num3;
Use strstr
int palindrome(char string[], int size)
{
if (size == 0 || size == 1)
return 1;
else if (string[0] != string[size - 1])
return 0;
else
...
Well, in some compilers, not including header files sometimes works for frequently used functions. But always include the necessary header files as a good programming practice.
atoi converts character strings only (whether you create strings with arrays or pointers, does not matter). It is seen from the prototype.
Are you trying to convert a single character to integer...
Does anyone know how to flush the input buffer in C++? I was able to do it in C by fflush(stdin) in C I/O, but I could not find its counterpart in C++. I am using a lot of input operations in my file...
#include <cstdlib>
#include <iostream>
using namespace std;
main()
{
int val;
long val2;
char *string = "1234567";
Yes, you can do this. Indeed this type of operations is the heart
of polymorphism. You can find a lot of detailed information in the Internet or in C++ books about polymorphism also.