>>Is there an opposite working function to strspn()?
Yep, strcspn() :-)
Type: Posts; User: Cela
>>Is there an opposite working function to strspn()?
Yep, strcspn() :-)
>>i mean how can the foundation of c code be c code? it couldnt of invented its self.
A compiler can be written in C since all it does is parse a text file and convert it to an executable. The fact...
:-)
#include <stdio.h>
int main(void)
{
int a = 12345;
do
stdin is always open in your program unless you do something unadvisable like fclose it :-)
If you have strrev, otherwise you can write your own really easily. This one is independent of any header files, meaning you don't need string.h :-)
#include <stdio.h>
static void...
>>But then you're not calculating them, your looking them up, which is a different thing altogether.
Right, it's faster :-)
>>I need to write a program that determines if a number entered is prime or not.
Get a list of known prime numbers, make a static array out of those numbers, then binary search that array when you...
>>I could possibl try doing it in perl, I put that in there in case anyone new how to do it in perl
It's a piece of cake :-)
#!usr/bin/perl -w
use Errno qw(EAGAIN);
FORK: {
if ($pid =...
>>$str1 = "^$a\\s+(b)(?:\\s+:\\s+$c\\s+$b)?\\s*";
This pattern will match the following
ax bx : cx d
>>$str2 = "^$a\\s+(b)(?:\\s+:\\s+$c\\s+$b)?\\s*{";
So will this one, see the...
>>would u know how to fix this problem?
With your restrictions you can't. If you enter a really large value then it'll overflow the unsigned variable and it'll probably be in range.
This sounds like an overly difficult assignment to me, the best approximation I can come up with while maintaining the restrictions you have is this
#include <stdio.h>
int get_int(void)
{
...
>>scanf("%5.2lf", &sale_amount);
Take out the 5.2 and it'll work fine :-)
Oh, that's what you wanted to do :-)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
unsigned int getInputData(){
>>switch(x > y ? true : false) // or 1 : 0
Why do that? Using a relational operator automatically returns true and false, it's redundant to do it explicitly :-)
>>would that still work in my function?
Sure, just paste it into your function and you're set :-)
>>getData.c:14: warning: passing arg 1 of `printf' from incompatible pointer type
It looks like...
Add the bold stuff to your program :-)
/* Fig. 2.1: fig02_01.c
A first program in C */
#include <stdio.h>
int main( void )
{
printf( "Welcome to C!\n" );
>>and i'm not too sure how to use the SizeOf Function, I need to use it to verify that an inputted integer is not greater than the maximun number of bytes allowed
First things first, sizeof isn't a...
>>If you're going to check for HUGE_VAL, you might as well check for -HUGE_VAL too.
Good point, but now that I think about it there's no reason to check for HUGE_VAL at all, since errno is set for...
That's a good point, I'll remember it :-) But first, one nitpick about that quote
>>This means that, even if you don't include the indicated header file
The ANSI standard says that they're...
All you need to do is throw in something to remove the newline character from the input stream. When you put a char into mode, there were actually two keypresses, one for the char itself and one for...
>>Dude, you're not forgetting string is a reserved name, are you?!
Since when? :-) The ANSI standard says only that function names beginning with str and a lower case letter are reserved, it also...
:-)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int is_float(char *src, size_t len)
{
It's best to seed the generator only once in the program :-)
Well, first, strcpy doesn't work like you expect. You can't copy a string to a simple pointer, there has to be space for it. Second, you can't copy strings with the assignment operator. Something...
>>but what is ADT?
Abstract data type :-)
>>If I use * for every structure passing, would it be safe?
Sure, as long as you use the pointers properly it's perfectly safe :-)