10 More Discussions You Might Find Interesting
1. Programming
I am passing a char* to the function "reverse" and when I execute it with gdb I get:
Program received signal SIGSEGV, Segmentation fault.
0x000000000040083b in reverse (s=0x400b2b "hello") at pointersExample.c:72
72 *q = *p;
Attached is the source code.
I do not understand why... (9 Replies)
Discussion started by: jose_spain
9 Replies
2. Programming
Have difficulty to understand this pure C code to only print vowels twice from input string. Questions are commented at the end of each place.
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
/*
*Demonstrate the use of dispatch tables
*/
/*Print a char... (11 Replies)
Discussion started by: yifangt
11 Replies
3. Shell Programming and Scripting
Hi,
In the following perl code:
#!/usr/bin/perl -w
if (open(FILE, "< in_file")) {
while (<FILE>) {
chomp($_);
if ($_ =~ /patt$/) {
my $f = (split(" ", $_));
print "$f\n";
}
}
close FILE;
}
Why changing the "FILE" as... (4 Replies)
Discussion started by: royalibrahim
4 Replies
4. Programming
if i create an array of pointers to a structure "struct node" as:
struct node *r;
and create "n" number of "linked lists" and assign it to the various struct pointers r using some function with a return type as structure pointer as:
r=multiplty(.......) /*some parameters*/
is... (2 Replies)
Discussion started by: mscoder
2 Replies
5. Shell Programming and Scripting
Hi,
What is the difference in the following two awk one-liners?
awk -F, '{s++} END {if (s == 1 && $4 > "09:10:00") {print $2, $4}}' f1
awk -F, '{s++} s == 1 && $4 > "09:10:00" {print $2, $4}' f1
Even though, all the 2nd column values have duplicate records, the first code does not give any... (4 Replies)
Discussion started by: royalibrahim
4 Replies
6. Programming
Hi guys.
how a functions such fdopen, ... can return pointer?
are these functions use static memory(variables)? (6 Replies)
Discussion started by: majid.merkava
6 Replies
7. Programming
Hi.
Problem: I have to parse the payload of a packet. The payload could be in Big Endian Format (network byte order) or little. That depends on a flag present in the header of the packet.
Solution: A horrible solution could be to check for that flag everytime I have to read a field in the... (11 Replies)
Discussion started by: emitrax
11 Replies
8. Programming
Hi,
I am trying to reverse a string using the following program utilizing the Exclusive OR bit operation:
int main() {
char str = "Quraish";
char *p = str, temp;
char *q = str + strlen(str) - 1;
while ( p != q ) {
if (*p != *q) {
*p ^= *q; *q ^= *p; *p ^= *q;... (1 Reply)
Discussion started by: royalibrahim
1 Replies
9. Programming
Hello all
im trying to build function that will return void function pointer
what is mean is ( not working )
the main function
void * myClass::getFunction(int type){
if(type==1)
return &myClass::Test1;
if(type==2)
return &myClass::Test2;
}
void myClass::Test1(){... (1 Reply)
Discussion started by: umen
1 Replies
10. Programming
i have a function:
char *pcCityIdToCountryName(ADMIN_DB_DATA *pstHEader, unit uiCityID)
this returns a pointer to CountryName if cityId is given.
to retrieve countryname i give:
char *CountryName;
CountryName = pcCityIdToCountryName(..................);
but when i compile it is giving :... (5 Replies)
Discussion started by: jazz
5 Replies