Narue 5,707 Bad Cop Team Colleague

It's very rare when one absolutely needs to keep everything loaded at the same time. I'd recommend changing your logic so that you only need to keep a few records in memory at once.

Narue 5,707 Bad Cop Team Colleague

I know what you mean, but wouldn't visual C++ know that the built-in STL strings behave in this way?

No, it wouldn't. That would add unnecessary coupling with a library that can be easily replaced. It's not entirely uncommon to replace the packaged standard library with a different implementation. I've done it myself more than once.

One other thing to note is that the standard library for Visual C++ is not written by Microsoft. It was written by Dinkumware and gimped by Microsoft to work with Visual C++'s weaker feature set. Dependencies in the optimizer on a specific version of the library would also add extra work in modifying future versions to fit Visual C++.

Finally, why bother? The cost of creating a new string object will probably outweigh the overhead of calling operator+ by an order of magnitude or more. Throw in return value optimization and removal of temporary objects and you've still got dubious gain for an optimization that only works in a very specific situation.

Well, thanks for the response though!

You say that as if I didn't answer your question...

Narue 5,707 Bad Cop Team Colleague

Hi, I was wondering if the compiler Visual C++ is smart enough to optimize code like this:

string temp = "abcd";
string temp2 = "hahaha";
string temp3 = temp + temp2;

"temp + temp2" can be replaced by "abcdhahaha"

Actually, Visual C++ is smart enough not to optimize in that way. There are infinite possibilities in the side effects of calling member functions. Removing the call entirely could change the behavior of the program, so the optimization is prohibited.

vector<char> alphabet;
for (char i = 'a'; i <= 'z'; i++)
{
    alphabet.push_back(i);
}

can be optimized to:

vector<char> alphabet;
//Avoid dynamic allocation
alphabet.reserve('z'-'a');
for (char i = 'a'; i <= 'z'; i++)
{
    alphabet.push_back(i);
}

This optimization doesn't avoid dynamic allocation entirely, it lumps the progressive allocations into one (Visual C++ grows by half again the current capacity). Not a bad optimization, but it's very specific to the vector class and trivial for client code to implement as necessary. I very much doubt Visual C++ implements your suggestion.

Narue 5,707 Bad Cop Team Colleague

I wonder why the following code work.

It doesn't. The recursive calls fail to fix the subtree:

if(root->data>item)
	root->left = insert(root->left,item);
else if(root->data<item)
	root->right = insert(root->right,item);
Narue 5,707 Bad Cop Team Colleague

it ain't my homework... its jes a small part of the project am doing as my final year project of engineering..

That fits our definition of homework.

its a humble request

You can't get everything you want just by being humble. You've posted a tiny amount of code and shown no real effort in solving the problem beyond begging and offering money for someone else to do it. This seems like a huge waste of time for those of us who are here with the goal of teaching.

Narue 5,707 Bad Cop Team Colleague

am seriously ready to pay a reasonable amount for this... around $20

Daniweb is not a programmer rental service. Offering to pay someone to do your homework is the kiss of death around here.

i need to submit tomorrow.

Congratulations, you've just gotten a lesson in time management from the school of hard knocks.

fp = fopen("C:\project\text1.txt","a+");

Double up the backslashes or reverse them, so they're not treated like escape sequences:

fp = fopen("C:\\project\\text1.txt","a+");
fp = fopen("C:/project/text1.txt","a+");

so '\t' is a tab character and '\p' is p (I think)

'\p' is an unrecognized escape sequence, and thus, undefined behavior.

tux4life commented: :) +8
Narue 5,707 Bad Cop Team Colleague

I am not very experienced in programming, but I think you can do this without using any of the functions like atoi(), etc....
Here's what comes to my mind:

1. Input the 'number' in the form of a string
2. for each character in the string, u can check if the ASCII value lies b/w 48(ASCII for character '0') & 57(ASCII for character '9') till you reach '\0' (if the condition is false at any point, u display the error message)
3. Otherwise, it means the user has input an integer. You can simply convert from a string to an integer by something like this:
multiply the character just before '\0' with 1 and store in an int (say int i=0), then the character 2 places before '\0' with 10 (then simply do i+=result), and so on....also note that before multiplying a character with 10,etc. subtract 48 from it....

I think this is simple enough....

Simple and broken. The listed algorithm fails to take signs into account and completely ignores the possibility of integer overflow. Doing this conversion manually is quite a bit harder than a lot of people realize. For example, here's a function that illustrates the work involved in only a partial implementation of the behavior supported by strtol. Notice how only a small portion of the code handles steps 2 and 3 of your algorithm. The rest is for error handling and robustness:

#include <cctype>
#include <cerrno>
#include <climits>

const char *parse_int(const …
Narue 5,707 Bad Cop Team Colleague

I am mildly surprised that using a stringstream is less efficient

It's makes perfect sense when you consider what's involved. Underneath iss>> value is a metric shitload of complex interwoven parts, only one of which performs a conversion from a streamed sequence of characters to an integer. On the other hand, strtol is very specialized and can be tuned for the sole purpose of converting a string to an integer.

I have also felt that the C++ stream library lacked the elegance displayed by say the STL containers.

The STL lacks a certain elegance as well, but yes, I agree with you. The stream library's biggest benefit to the programmer is type safety and extensibility (not a small benefit, to be sure). Beyond that it's too verbose for all but the simplest of cases.

jonsca commented: Can you translate a metric shitload to American units? :) +4
Narue 5,707 Bad Cop Team Colleague

I think you're confused about how the insert member function works for the vector class. You'd probably be better off simply using the overloaded subscript operator:

productMap[prod->GetCode()] = prod;
static map<string, ProductLine*, less<string> > productMap;

less<KeyType> is already the default predicate, you don't need to specify it unless you want a different ordering. Also note that your key type is string while prod->GetCode() returns a ProductCode object with no implicit conversion to string. I suspect you really want the key type to be ProductCode.

Narue 5,707 Bad Cop Team Colleague

Just post your code, already. Ideally write up a bare bones program that exhibits your problem without being excessively long. Playing twenty questions is unproductive, especially when the problem sounds like something most of us can solve at a glance.

Narue 5,707 Bad Cop Team Colleague

Post your error code please.

I agree. The code is more or less fine. The using namespace std statement at the top of the date.h header could cause a problem, but that should have nothing to do with accessing public vs. private members.

You're trying to access a private variable from outside the class. void date::wordform(date d1) Although you're inside the date class, you're not inside the instance of d1.

All member functions of a class have access to private members, even members of different objects of the class. There's nothing technically wrong with date::wordform, though the design is confused (it should either be a member function with no parameters or a non-member function with one date parameter).

Ketsuekiame commented: Good answer and thanks for correcting me ^^ +1
Narue 5,707 Bad Cop Team Colleague

however neither of those are C++ they are part of the C standard library and C++ provides the same functionality through the use of stringstreams.

Just chiming in with a minor correction. atoi and strtol are most certainly C++. You shouldn't buy into the "pure C++" BS that encourages one to eschew all things inherited from C that have a C++ counterpart.

In this particular case, I've often found stringstreams to have a statistically significant overhead when compared to strtol (atoi is evil, of course, and should be ignored as a viable solution). Just because the functionality is the same doesn't mean the two options are equivalent. In performance critical code I've used strtol because it was just plain faster.

Narue 5,707 Bad Cop Team Colleague
string B = "B";
Narue 5,707 Bad Cop Team Colleague

Is CEA_Process forward declared prior to CEA_Disk_lister? Because as posted it won't exist and the definition of CEA_Disk_lister will fail.

Narue 5,707 Bad Cop Team Colleague

Sorry anuragcoder, I'm going to ignore you now. Hopefully you'll realize that flooding the forum with bad questions is counterproductive and start concentrating on quality rather than quantity.

In the meantime, here's some light reading for you.

Narue 5,707 Bad Cop Team Colleague

kbhit is a function. It returns a boolean value (in the form of an int) telling you whether there's a keypress waiting in the keyboard buffer. You use it like this:

if (kbhit())
{
    // A key was pressed
}
else
{
    // No key presses waiting
}
Narue 5,707 Bad Cop Team Colleague

I triet kbhit() but it seems to be useless.
Same case with_getch();

How did you try them? Is it more likely that they're actually useless, or you simply didn't use them correctly?

Narue 5,707 Bad Cop Team Colleague

Heck with the error.
I'm unable to find it.
Hint please...

How's this for a hint? Start over and work through your program slowly. Write test programs to teach yourself how things work, then use that knowledge to incorporate functions and constructs into your program.

In this thread I'm getting a distinct sense of helplessness and laziness. Probably the biggest reason you're not encouraging people to help is you're completely failing to help yourself first and you're not making the most of the help given.

Narue 5,707 Bad Cop Team Colleague

undefined symbol _main in module c0.ASM

A complete C program requires an entry point. The entry point is called main; you may have heard of it.

where to put the printf("Enter values: ");?

The main function that you're going to add.

in the scanf, what variable i would use? is it the i or j or i would create new variable?

I would write directly to the array (in main):

for (i = 0; i < n; i++)
{
    scanf("%d", a[i]);
}

and is there more code to add other than the printf(inputed value),scanf(inputed value)?

It depends on what you want the program to do. Perhaps you want to print the before and after to make sure the array is being sorted.

what does this mean (i=0; i<n-1; i++), (the red one)

Stop the loop before the last item in the array. It's the same as i < n except one step earlier.

Narue 5,707 Bad Cop Team Colleague

Hi,

Didn't know which section to write this in. :(

I would like to know how could I delete two of my threads, since they show up on google search and I don't want them to.

Of course editing would be an option, but lately edit post button only shows on some of my threads.

Thank you in advance.

Hmm, I'm curious why you don't want them to show up.

Narue 5,707 Bad Cop Team Colleague

There are a number of ways to do it. Here's one:

#include <iostream>
#include <string>

int main()
{
    using namespace std;

    string text;
    int nl = 0;

    cout<<"Press enter twice in a row to quit: ";

    while (nl < 2 && getline(cin, text))
    {
        if (text.empty())
        {
            ++nl;
        }
    }
}
Narue 5,707 Bad Cop Team Colleague

Are you trying to compare the vectors as a whole? As in if (buy <= ask) ?

Narue 5,707 Bad Cop Team Colleague

I am not sure what EOF is on the keyboard or what triggers it.

If you're on Windows, the Ctrl+Z key combination sill signal end-of-file and cause getchar to return the EOF flag rather than extract a character from the stream. On Unix/Linux, the key combination is Ctrl+D.

Narue 5,707 Bad Cop Team Colleague

Example to get you started:

#include <ctime>
#include <iomanip>
#include <iostream>

using namespace std;

void wait(int seconds)
{
    clock_t endwait;
    endwait = clock() + seconds * CLOCKS_PER_SEC;
    while (clock() < endwait) {}
}

int main()
{
    const int dots = 3;
    const int n = 5;

    cout<<"LOADING";

    for (int i = 0; i < n; i++)
    {
        cout.put('.');
        wait(1);

        if ((i + 1) % dots == 0)
        {
            // Reset the dots
            cout<< setw(dots) << setfill('\b') <<""
                << setw(dots) << setfill(' ') <<""
                << setw(dots) << setfill('\b') <<"";
        }
    }

    cout<<"\nDONE!\n";
}
Narue 5,707 Bad Cop Team Colleague

>So have your routine choose either 0 or 1 (so use rand() % 2)
>and then select the appropriate number with an if statement.
rand() % 2 is especially risky when it comes to getting the same result every time (for reasons I'm not interested in detailing at the moment). This has worked better for me in the past:

if (rand() < RAND_MAX / 2)
{
  /* Pick one number */
}
else
{
  /* Pick the other number */
}
Narue 5,707 Bad Cop Team Colleague

>A simple and kind no would have sufficed.
No, it wouldn't. If it were a simple no, you wouldn't understand why people are refusing to help you. And if it were kind, you wouldn't get enough of a shock to correct your mistake next time.

Narue 5,707 Bad Cop Team Colleague

The operator= you define is for the Vertex class. It only applied when you assign something to a Vertex object. What you apparently want is an implicit conversion:

class Vertex
{
public:
	Vertex();
	operator double() { return value; }
private:
	double value;
};
nkinar commented: Great post; and extremely enlightening! +0
Narue 5,707 Bad Cop Team Colleague

>I just can't seem to compile it.
>Will someone please give me some suggestions?

I'd suggest reading the errors, tracing the source of the problem, and applying a fix to the code. What were you wanting us to do? Debug your code and give you the working program? Do you want fries with that?

Narue 5,707 Bad Cop Team Colleague

>Any thoughts?
That feature already exists. If there are any approved tutorials for a forum you can find them under the "related forum features" box. As for submitting tutorials, I don't recall what the procedure is. Probably email or PM it to one of the admins for approval.

Narue 5,707 Bad Cop Team Colleague

>Found a lot of threads with this error but no compatibility mode solved any of them.
I don't care about them. Did it help your problem?

>When I saved this codeunder a new name this was the last result I got from it:
I'll assume you neglected to mention a ctrl+z after typing '8'. If that's the case, your output is expected.

Narue 5,707 Bad Cop Team Colleague

>can some through some light that why is it behaving like this ?
It would truly suck for testing if rand weren't default seeded to a predictable value. As such, if you don't call srand, the program will behave as if you called srand(1) .

>time_t t;
>time(&t);
>srand(t);

The one-liner is generally preferred:

srand((unsigned)time(0));

But this is C++. We can do better by wrapping everything in a class and letting the object do all of the grunt work:

#include <cstdlib>
#include <ctime>
#include <iostream>

class Random {
public:
    Random(bool seed=true)
    {
        if (seed)
        {
            std::srand((unsigned)time(0));
        }
    }

    double get()
    {
        return std::rand() * (1.0 / (RAND_MAX + 1.0));
    }

    int next(int hi)
    {
        return (int)(get() * hi);
    }

    int next(int lo, int hi)
    {
        return (int)(lo + get() * (hi - lo));
    }
};

int main()
{
    Random r;

    for (int i = 0; i < 10; i++)
    {
        std::cout<< r.next(1, 6) <<'\n';
    }
}
The ICE Man commented: Good One :) +0
Narue 5,707 Bad Cop Team Colleague

What version of Windows? Is it 32-bit or 64-bit? What compiler and version? There's nothing wrong with your code, and I have heard of this error on Windows 7 before. Have you tried using compatibility mode, and does it still fail?

Narue 5,707 Bad Cop Team Colleague

C++ doesn't allow the binding of temporary objects to non-const references. Your overloaded operator+ is returning a temporary object, which you then try to pass as a non-const reference to the overloaded operator=.

You can fix it by being const correct (a good idea anyway):

dummy& operator=(const dummy &rhs)

Note that const should generally be used if you aren't modifying the parameter. That guideline usually makes problems like this one go away.

Narue 5,707 Bad Cop Team Colleague

>Can anyone tell me why such difference occurs?
When printing a string (no format specifiers), the difference between puts and printf is that printf probably does more work for the same result. The reason is because printf needs to check for format specifiers while puts simply passes each character on to putchar. But your problem isn't related to which function you use for display.

>char b[8];
>strncpy(b,a,7);
>puts(b);

Your punishment is to write "I will null terminate all of my strings" 100 times on the blackboard. When you fail to end a string with '\0', garbage is usually the result. For example, running your program I get this:

barbara╠╠╠╠╠╠╠╠╠barbara dickens
barbara╠╠╠╠╠╠╠╠╠barbara dickens

strncpy is typically misunderstood because it doesn't really do what you would assume it's supposed to do, which is strcpy with a limit. Because of that, strncat is often preferred if you want a strcpy with a limit. Just set the destination as an empty string:

b[0] = '\0';
strncat(b, a, 7);

Or you could use strncpy and not forget to terminate the string:

strncpy(b, a, 7);
b[7] = '\0';

It's a subtle difference in this case, but I think significant enough to avoid bugs.

Narue 5,707 Bad Cop Team Colleague

>Ok let me try rephrasing it.
I'll do the same. Post your String class. You won't get any solid answers until we know how it works.

>I didn't use vectors because i thought it was too much for him already
Then you have two choices:

  1. Make a huge array and hope the string isn't longer.
  2. Dynamically allocate an array.

The former is risky and wasteful, the latter is more complicated than using vectors. Personally, I think the standard library should be introduced as early as possible to avoid the overwhelming lower level stuff.

>By the way i know that casting the const away is brute force
It's not brute force, it's just plain unsafe. On closer inspection it's probably okay in this case since you don't actually modify the string, but still a horrible example to set if you're trying to teach something other than how not to write C++.

>so stop showing off
Pointing out problems in your code is showing off? Get over yourself. You're making matters worse by jumping to conclusions and posting bad code that isn't even usable by the OP.

Narue 5,707 Bad Cop Team Colleague

>The guy asked how to split a string in chars.
No, he asked how to change the case of characters in a string. He also failed to describe how the non-standard string class being used works. If it's mutable, extracting the characters is completely unnecessary. If it's immutable then it makes more sense, but if it's immutable I would rather expect a robust collection of member functions and friends to handle this kind of grunt work.

>Holds is not supposed to be used as a string but to extract characters from it.
If it's not supposed to be a string, then I concede that point.

>Bet it works
Bet I can break it without changing the code. What you posted exhibits undefined behavior and supremely stupid programming practices.

>why don't you post something better ?
That's easy enough:

#include <cctype>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>

std::string uppercase(const std::string& s)
{
    typedef std::vector<char>::iterator iter_t;

    // Assume std::string is immutable for fun
    std::vector<char> conv(s.begin(), s.end());

    for (iter_t it = conv.begin(); it != conv.end(); ++it)
    {
        *it = std::toupper((unsigned char)*it);
    }

    return std::string(conv.begin(), conv.end());
}

int main(int argc, char *argv[])
{
    if (argc < 1)
    {
        std::cerr<<"usage: $prog <string>\n";
        return EXIT_FAILURE;
    }

    std::string before(argv[1]);
    std::string after = uppercase(before);

    std::cout<<"Before: "<< before <<'\n';
    std::cout<<"After:  "<< after <<'\n';

    return EXIT_SUCCESS;
}

Though it's only "better" in terms of correcting your broken code. It doesn't help the OP at all because we still don't know …

Narue 5,707 Bad Cop Team Colleague

>I don't see why I shouldn't be a little curious about
>how compilers compile while loops, in my spare time.

I don't either. Personally, I'd love to talk about the inner workings of compilers with someone interested in the subject. But it wasn't clear that you're generally interested in the machine code produced by compilers. Rather, it seemed like you were counting cycles and then asking us if your performance tests were "expected" across all compilers of all languages. :icon_rolleyes:

>I regret having bothered the forum with such a controversial subject.
It's not controversial at all, and if you're going to be a whiny baby after a couple of people misinterpret your misleading question, I don't regret not answering it.

Narue 5,707 Bad Cop Team Colleague

>argc=1;
>string str=argv[argc];

Wow. That's actually pretty impressive for a Bug of Ignorance™.

>char holds[100];
Erm, how do you know str.size() is less than 100?

>char* s=const_cast<char*>(str.c_str());
What a fantastically horrible idea! c_str returns a pointer to const char for a reason, and that reason isn't so you can cast it away and modify the memory anyway. :icon_rolleyes:

>for (unsigned int i=0;i<str.length();i++)
I hope I'm not the only one who sees a failure to terminate the holds string with a null character.

Narue 5,707 Bad Cop Team Colleague

>Well at least you didn't mention premature optimization.
I suspect you get that a lot. Probably for good reason.

Narue 5,707 Bad Cop Team Colleague

>Any number that can be expressed in p/q format where q≠0 (p & q belong to set of integers)
Translation: rational numbers can always be represented by a fraction p/q where q is not zero. So you need to write a common fraction "class":

typedef struct rational {
  int numerator;
  int denominator;
} rational;
Narue 5,707 Bad Cop Team Colleague

It's hard to help you without knowing more about this String class. If it's even remotely reasonable, you should be able to do this:

for (int i = 0; i < s.length(); i++)
  s[i] = toupper(s[i]);

>char state[2] = {patientState};
This is probably wrong. I suspect patientState is a String object.

>if (state[1] >= 97 || state [1] <= 122)
Even assuming the assumption that these values correctly represent 'a'-'z' and the reader is expected to know that, magic numbers are bad. You can use character literals to the same effect and the code will be vastly more readable. Or you can use the functions from <cctype> and avoid this kind of grunt work entirely.

>state[1] -= 32;
This isn't guaranteed to work. Not all character sets are compatible.

>exit(9);
There has to be a better way to respond to an invalid character than terminating the application. Especially from a utility class. :icon_rolleyes:

>fixState = state[1] + state[2];
Array indices start at 0 in C++. You're accessing the array out of bounds.

Narue 5,707 Bad Cop Team Colleague

>Define rational number as an ADT (abstract data structure)
I fail to see how this is difficult. What kept you from completing the exercise?

>Write a suitable C code to sort a finite set of elements
>where an element may appear a large number of times

Well any general sorting algorithm will do this, so now you only need to find one where the processing of duplicate values is efficient. Might I suggest counting sort?

Narue 5,707 Bad Cop Team Colleague

>I am not asking about a qualified id
I know that, and if you were reading for comprehension, you wouldn't have been so quick to dismiss my answer.

>&test::d // which is what I believe 5.3.1 paragraph 2 quoted by Narue refers to
Dude, read the whole freaking paragraph. It even starts with the material that you're looking for:

The result of the unary & operator is a pointer to its operand. The operand shall be an lvalue or a qualified-id. In the first
case, if the type of the expression is “T,” the type of the result is “pointer to T.”

In your example, t.d is an expression resulting in an lvalue with a type of double, thus &t.d legally produces a result of pointer to double. Section 5.2.5 confirms that t.d is an lvalue.

If you want to get answers from the standard, you can't gloss over whole sentences.

Narue 5,707 Bad Cop Team Colleague

>So can some of the knowledgeable person here tell me if it is ok,
>and if so direct me to some part of the C++ standard that say so

It's okay. Section 5.3.1, paragraph 2.

>void main(){
You might also enjoy section 3.6.1, paragraph 2. The number of people I've known who write code in a freestanding environment and post questions to a forum such as Daniweb is currently holding at zero.

Narue 5,707 Bad Cop Team Colleague

>Thank you!
I love it when people ignore my help and then thank me. It's even better when they choose a horrible solution in favor of my superior recommendations. :icon_rolleyes:

Narue 5,707 Bad Cop Team Colleague

>I know that I can't read anything directly: http://www.cplusplus.com/reference/c...cstdio/sscanf/
I'm well aware of what sscanf does and how it works. I was making a joke, seeing as how sscanf reads from a string rather than a file.

>I can't read an uint16 from a file for this reason:
So what's the problem? You have an answer and it's easy to do. Though there are nuances that make your code non-portable, not the least of which is the assumption that uint32 resolves to int and uint16 does not. You would probably be better off using long and short instead of uint32 and uint16, respectively. long is guaranteed to be at least 32 bits and short is guaranteed to be at least 16. Then to read "uint16" with sscanf, you can use the %hd specifier as described in the first link you provided.

Narue 5,707 Bad Cop Team Colleague

>I can't read uint16 directly from a file using sscanf
You can't read anything directly from a file using sscanf.

>Is that possible?
I think you need to be more specific. Why do you think you can't read a uint16 value?

Narue 5,707 Bad Cop Team Colleague

You need to shift all elements past the one to be deleted. Currently you only shift the first, which leaves you with something not quite what you wanted. Compare with this, which deletes the first occurrence of the selected value:

for(int i=0; i<length; i++)
{
    if(arr[i] == key)
    {
        while (i < length) {
            arr[i] = arr[i+1];
            ++i;
        }

        break;
    }
}
Narue 5,707 Bad Cop Team Colleague

>in the above link they are saying, user should definitely NOT write code of the form
They're wrong. That code (ignoring gets) is best practice. Assuming for a moment that the author of that page isn't an idiot, I'd say there's an implicit assumption about the system/implementation here:

let the implicit output-flushing routines handle everything for you

There are two implicit flushing "routines":

  1. When a newline character is sent to the output stream in question.
  2. When the output stream buffer is full.

It should be obvious that #2 can't be relied on if you want your user prompts to show up...well, promptly. If you want user input to be on the same line as the prompt a newline at the end of the prompt to force a flush isn't practical. The only other way to flush the stream is fflush.

The truly humorous part is how the biggest argument against fflush from that page is overhead. Let's think about this logically using the two examples:

/* Example 1 */
printf("Prompt: ");
fflush(stdout);
gets(s);
/* Example 2 */
printf("Prompt: ");
gets(s);

Assuming the "implicit flushing routines" handle everything for you, one would expect both prompts to show up before gets blocks for input. This is the normal expected behavior, and if the second example fails to do it (because there's no flush), that's a strong argument in favor of using fflush.

However, if both examples do show the prompt correctly, that means under …

urbangeek commented: her answer resolved all my queries, even those i didn't ask!! :) +0
Narue 5,707 Bad Cop Team Colleague

>Yes you can use its source code to all os
Assuming a compiler exists that targets the desired operating system. That's generally a safe assumption with C, but it does mean that you'll find systems where C isn't an option due to lack of developer tools.