Narue 5,707 Bad Cop Team Colleague

But if I enter abcf:6252::ffff its not work.

That's understandable. scanf() doesn't know what IPv6 is, you need to figure out how to turn "abcf:6252::ffff" into "abcf:6252:0000:0000:0000:0000:0000:ffff" and write code to do it. That means counting how many fields are missing and filling them in with zeros.

Narue 5,707 Bad Cop Team Colleague
int[] b = new int[0];
int[] c = new int[0];

Arrays of size zero...sounds useful. :icon_rolleyes:

Antenka commented: :D And how fast! +7
Narue 5,707 Bad Cop Team Colleague

i donot know what to do can u explain me by the help of code please.

You have no choice but to make sure the source string passed to strtok() is modifiable. That means either storing it initially in an array:

#include <stdio.h>
#include <string.h>

int main(void)
{
    char src[] = "asim.nazeer.helo.me";
    char *tok = strtok(src, ".");
    
    while (tok != NULL) {
        printf("'%s'\n", tok);
        tok = strtok(NULL, ".");
    }

    return 0;
}

Or making a copy if you don't control the string provided or need to retain the original string for any reason:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void foo(const char *s) // Assuming no control over s
{
    char *copy = malloc(strlen(s) + 1);
    char *tok;
    
    if (copy == NULL)
        return;
        
    strcpy(copy, s);
    
    for (tok = strtok(copy, "."); tok != NULL; tok = strtok(NULL, "."))
        printf("'%s'\n", tok);
}

int main(void)
{
    char *src = "asim.nazeer.helo.me";

    foo(src);

    return 0;
}
Narue 5,707 Bad Cop Team Colleague

It would appear that the memory space on which the string is stored is not modifiable.

Correct. String literals are defined as read-only by the language, and strtok() modifies its argument.

Narue 5,707 Bad Cop Team Colleague

I have an idea with this program. I get an input, store it in s1.
strlen to check how long s1 is and then that would let me know if
its in the hundreds,tens, or ones.

That's a good approach. If you know what the digit is and what place it's in, the only slightly tricky part is handling paired numbers like the teens so that your output is correct.

Narue 5,707 Bad Cop Team Colleague

But the problem is that when the string is abcf:6252::ffff
My output will be abcf:6252::0001:0000

Can you help me in this matter?

What's wrong with that output? It looks fine to me:

Original:    "abcf:6252::ffff"
Expanded:    "abcf:6252:0000:0000:0000:0000:0000:ffff"
Incremented: "abcf:6252:0000:0000:0000:0000:0001:0000"
Compacted:   "abcf:6252::0001:0000"
Narue 5,707 Bad Cop Team Colleague

I may have written it a bit 'cryptic' as to maybe minimize random ripoffs.

Let's start with this. You're not going to make money off of this algorithm, and the bragging rights are tangential to devising a solid algorithm. I wouldn't worry about anyone ripping off your idea, but being cryptic certainly makes it difficult for interested parties to use it if it applies to their problem or help answer your question.

I achieve this by first doing compares of every other two elements. 'Pairing'.

Given your cryptic description, I'd say you've come up with a variant of Shell sort. Or at the very least, an algorithm that moves in the same direction as Shell sort by grouping elements in a way that speeds up the process.

Narue 5,707 Bad Cop Team Colleague

Is there a basic criteria for a entry level programmer?

When hiring entry level programmers, I've always looked for three things:

  1. Willingness to learn: Since we're talking about bottom of the barrel as far as applicable skills goes, the candidate absolutely must be a sponge for knowledge.
  2. Passion: Entry level folks shouldn't be embittered by the field yet, so interest in everything (languages, tools, methodologies, etc...) is expected in a good candidate.
  3. Baseline competency: A good candidate should understand the core concepts of programming. While lack of experience severely limits expectations, I always keep in mind that the candidate is applying for a job as a professional in the field. You wouldn't apply for a job as a cook if you know nothing about preparing food, after all, and the same goes for programming. I expect at least a passing familiarity with the fundamentals.
Narue 5,707 Bad Cop Team Colleague

Actually, a paraphrase is "relatively small part of an article written in your own words". A quote is a relatively small part of an article taken verbatim.

I hadn't considered that interpretation. What I meant was "a quote is a relatively small part of an article otherwise written in your own words". That is, the quote is verbatim, but it's contained within an article that's not verbatim and the quote is a relatively small part of the total article.

Narue 5,707 Bad Cop Team Colleague

I don't know what you mean by rogue opening paren.

Count the parens. Two opening, one closing. Do I have to hold your hand the whole way?

Plus I get this error, I don't know what this means:

Prior to C99, you couldn't declare a variable in the initialization clause of a for loop. GCC doesn't enable C99 mode by default, yet your code uses that feature here:

for(int i = 0; i < c; ++i)

and here:

for(int i = 0; i < 5; i++)
Narue 5,707 Bad Cop Team Colleague

What do you mean?

If you don't see it after it being pointed out, I'd recommend re-reading your chapter on functions:

void prefix((char x1[]; char x2[])

Parameters are separated by a comma, not a semicolon, and you have a rogue opening paren.

Narue 5,707 Bad Cop Team Colleague

Your prefix() function signature is jacked up. Fix that and you'll get other errors that are easier to fix.

Narue 5,707 Bad Cop Team Colleague

as I was constructing a small program, I discovered my error

That's what I was hoping would happen. Now you have one more tool in your troubleshooting arsenal.

Narue 5,707 Bad Cop Team Colleague

Start by checking if an array is sorted. Or in your teacher's terms "single sorted". :icon_rolleyes: Once you have the logic for determining if a sequence of values is in sorted order or not, you can apply a filter such that only even numbers are considered or only odd numbers are considered. Then run the algorithm twice: once for even numbers and once for odd numbers. Problem solved.

Narue 5,707 Bad Cop Team Colleague

Can you post more code? Specifically, how are DEMOD_NBR_INPUTS and iter defined? Here's an idea: write a complete program that's both small and exhibits the error. Then post that so other people don't have to play twenty questions with you just to get the necessary information for helping out.

Narue 5,707 Bad Cop Team Colleague

So lets say you are given 10 seconds to answer the question and every correct answer adds you 10 seconds. How would i implement this?

The simplest approach would have you checking the difference of the time between the point where the question is displayed and the point where the user has submitted an answer. The benefit of this is it doesn't have to be real-time, which would require more complex concurrency techniques.

Narue 5,707 Bad Cop Team Colleague

where do i put the above within my own code?

Use some common sense. Given that my snippet performs the same operation as the part of your code that parses a line and stores the result in numbers[I] , that's a good place to start experimenting.

Narue 5,707 Bad Cop Team Colleague

try subtracting 42 or 48 from the character, I think one of these is the right number.

It's 48 in ASCII and Unicode. But you don't have to remember what the value is if you simply subtract the character '0':

for (char x = '0'; x <= '9'; x++)
    cout << x - '0' << '\n';

(sr-65)
as sr is A(with ascii 65 )
so 65-65=0
0 is what i wan in this case

bool chess_coord(char col, char row, int& x, int& y)
{
    col = toupper((unsigned char)col);
    
    if ((col < 'A' || col > 'H') &&
        (row < 1 || row > 8))
    {
        return false;
    }
    
    x = col - 'A';
    y = row - '0' - 1; // -1 to force 0-based indexing

    return true;
}

This assumes coordinates will be 1-based coming in and 0-based going out, so the ranges of 1-8(rows) and A-H(columns) will be converted to 0-7.

Narue 5,707 Bad Cop Team Colleague

There are two steps. First, use the uint type. Second, validate the input string against the uint type before saving it:

uint value;

Console.Write("Enter a positive integer: ");

while (!uint.TryParse(Console.ReadLine(), out value))
    Console.Write("Invalid input. Enter a positive integer: ");

numbers[I] = value;
Narue 5,707 Bad Cop Team Colleague
char a[ITEM_SIZE];

if (fgets(a, sizeof a, stdin) != NULL)
    push(a, sizeof a);

pop(a, sizeof a);
puts(a);
Narue 5,707 Bad Cop Team Colleague

It depends on how you're storing the items of the stack. Personally, I would use an array of structures:

struct item {
    char a[ITEM_SIZE];
};

struct item stack[STACK_SIZE];
size_t top = 0;

With that setup, pushing and popping are a simple matter of copying the contained array:

void push(const char a[], size_t size)
{
    if (top >= STACK_SIZE)
        return;

    if (size > ITEM_SIZE)
        size = ITEM_SIZE;

    memcpy(stack[top++].a, a, size);
}

void pop(char dst[], size_t size)
{
    if (top == 0)
        return;

    if (size > ITEM_SIZE)
        size = ITEM_SIZE;

    memcpy(dst, stack[--top].a, size);
}
Narue 5,707 Bad Cop Team Colleague

But this code is not running or not compiling.

No shit. I'm not going to do your work for you, and as such, I didn't give you all of the code from my program. The definitions for ipv6_normalize() and ipv6_tostring() are key examples, those functions are the meat of the program in that they do the heavy lifting of preparing the IPv6 string for conversion to parts and for display.

I also didn't include headers, which should be the first flag that the code is a snippet and not compilable as-is.

Narue 5,707 Bad Cop Team Colleague

You may quote and reference Daniweb content, but you may not reproduce the content. The difference is that a quote is a relatively small part of an article written in your own words, and reproduction is a large scale copy/paste of our content with little or none of your own.

Narue 5,707 Bad Cop Team Colleague

What you want is obfuscation rather than encryption, assuming the intention of encrypting the DLLs is to hinder reverse engineering efforts. There are a number of tools (Visual Studio comes packaged with Dotfuscator's community edition). Just Google for ".net obfuscation".

Narue 5,707 Bad Cop Team Colleague

A file descriptor is conceptually much like the FILE pointer you use in standard C. In fact, on systems that use file descriptors (such as Linux and Unix) you'll find that the definition of the FILE struct actually stores one as a the underlying file handle.

On the assumption that you're using a compiler which supports fdopen(), that would be the easiest way to handle the file descriptor. What fdopen() does is create a FILE pointer from a file descriptor. Then you can use it just as you would fp:

void echoFile(int fd, char *filename) {
    FILE* out = fdopen(fd, "w");

    if (out != NULL) {
        FILE* fp = fopen(filename, "r");
        int ch;
 
        if(fp == NULL) {
            fprintf(stderr, "The file specified does not exist\n");
            return;
        }

        while ((ch = getc(fp)) != EOF) {
            putc(ch, out);
        }

        fclose(fp);
        fclose(out);
    }
}
Narue 5,707 Bad Cop Team Colleague

You can chose between speed or space.

Or you can choose clarity. Given that we're talking about ten numbers in the range of 0 to 100, either method will be fast enough and space thrifty enough.

Narue 5,707 Bad Cop Team Colleague

Don't store each hex value as a string, store it as a short. Then the increment is trivial. Here's my driver for the program without the increment step:

int main(void)
{
    const char *ip_src = "fe80::0204:61ff:fe9d:ffff";
    char *s = ipv6_normalize(ip_src);
    uint16_t parts[8];
    size_t k = 0;
    
    printf("Source:     '%s'\nNormalized: '%s'\n", ip_src, s);
    
    for (char *tok = strtok(s, ":"); tok != NULL; tok = strtok(NULL, ":"))
        sscanf(tok, "%hx", &parts[k++]);
    
    free(s);
    puts("IPv6 Parts:");
    
    for (size_t i = 0; i < k; i++)
        printf("\t%d: %hX\n", i + 1, parts[i]);
    
    // Increment from right to left until the result isn't 0 (unsigned wrap)
    
    puts("IPv6 Parts (after increment):");
    
    for (size_t i = 0; i < k; i++)
        printf("\t%d: %hX\n", i + 1, parts[i]);
        
    s = ipv6_tostring(parts, false);
    printf("Reformatted (normalized): '%s'\n", s);
    free(s);
    
    s = ipv6_tostring(parts, true);
    printf("Reformatted (shorthand):  '%s'\n", s);
    free(s);
        
    return 0;
}

The increment step is a simple loop, but I didn't want to do all of the work for you.

Narue 5,707 Bad Cop Team Colleague

For each number you read, loop over all of the numbers presently read into the array and compare with the number. If there's not a match, append the number to the array. Repeat until the array contains ten numbers.

Narue 5,707 Bad Cop Team Colleague

Because it's a 16-bit compiler designed for MS-DOS in the 80s? Grow up and use a modern compiler, or stop whining and downgrade your OS to something closer to the Turbo C era.


p.s. For those of you who are tempted to chime in that Turbo C can be run successfully on Windows 7, stuff it. It's well past time for Turbo C to die, so put away the defibrillators and let it go peacefully. The longer we cater to stupid people trying to use compilers from the age of shoulder pads and slap bracelets, the longer it will take for legitimate advances over the last twenty years to be adopted.

Narue 5,707 Bad Cop Team Colleague

Can any body help me for solving the code using C language.

Start by ignoring the requirement to handle the "::" shorthand. That's the only part of the problem that makes it even remotely difficult.

You will likely want to break the problem down into two distinct parts: parsing input and managing the increment.

Depending on how you choose to handle the increment, reformatting the IP address may be necessary. I think the best approach would be to normalize the input string, break it down into an array of 16-bit integers, handle the increment, and then convert the array back to a string.

Since it's a surprisingly amusing exercise, I did it on my end. The only somewhat tricky part is handling the consecutive zeros shorthand. Here's my output for one test:

Source:     'fe80::0204:61ff:fe9d:ffff'
Normalized: 'fe80:0000:0000:0000:0204:61ff:fe9d:ffff'
IPv6 Parts:
        1: FE80
        2: 0
        3: 0
        4: 0
        5: 204
        6: 61FF
        7: FE9D
        8: FFFF
IPv6 Parts (after increment):
        1: FE80
        2: 0
        3: 0
        4: 0
        5: 204
        6: 61FF
        7: FE9E
        8: 0
Reformatted (normalized): 'fe80:0000:0000:0000:0204:61ff:fe9e:0000'
Reformatted (shorthand):  'fe80::204:61ff:fe9e:0'

It's about 130 lines of code, and that's a first draft, so that should be a taste of what it takes to do the job in C.

Narue 5,707 Bad Cop Team Colleague

I must have the char b declared is it?

Yes, there must be an array (or simulated array) with enough space allocated to pass to sprintf().

So in my case I should put something big right?

Let's do the math. Following are the fields you said you want to serialize and their maximum character lengths:

10 -- u_int32_t caplen;
10 -- u_int32_t len;
10 -- u_int32_t pkt_hash;
5  -- u_int16_t parsed_header_len;
5  -- u_int16_t eth_type;
5  -- u_int16_t vlan_id;
3  -- u_int8_t  ip_version;
15 -- ip_addr   ip_src;
15 -- ip_addr   ip_dst;

ip_addr is an unknown, but I'll assume it's another structure with four (or six) fields corresponding to each part of an IP address. I'll further assume assume you want to format an IPv4 address, for simplicity. Given these numbers, plus the space for comma separation and a null character at the end, the size of your array needs to be 87 or more.

Narue 5,707 Bad Cop Team Colleague

I assume I could have a <prerequisites> tag at the start of each <software>, also with the name, file path, type, switches tags within and just leave them blank when software doesn't have any?

You can just have an empty tag for the prerequisites, much easier:

<software>
	<prerequisites />
	<name>Autodesk Buzzsaw 2012</name>
	<file_path>Applications\Buzzsaw\Buzzsaw-2012-EN.exe</file_path>
	<type>exe</type>
	<switches>/Q</switches>
</software>
Narue 5,707 Bad Cop Team Colleague

Maybe Narue can clear up the proper use of each

Sorry, there's no consensus as far as I can tell. I just use whatever makes the most sense at the time. ;)

Narue 5,707 Bad Cop Team Colleague

Please post more code. Ideally it would be a complete (SHORT!) program that we can cut, paste, and compile as-is and see the error.

Narue 5,707 Bad Cop Team Colleague

It's simply leads to more memory consumption....

Properties don't consume memory in the object, they're a form of method that acts like a field.

Somebody says that,it provides security,but here still anyone can edit the value of PI. Then how we can say it as a secured one....

If you write properties that expose fields completely then there's no security benefit over public fields. However, consider this modified property:

public double PI {
    get {
        if (!_piGenerated) {
            _pi = GeneratePi(_piPrecision);
            _piGenerated = true;
        }

        return _pi;
    }

    private set { _pi = value; }
}

Now the set isn't accessible outside of the class, and the get performs some internal logic that doesn't matter to users of the property. This is the power of properties, you can get method-like behavior with field-like syntax.

Narue 5,707 Bad Cop Team Colleague
ss=time[7]+10*time[6];
mm=time[3]+10*time[4];
hh=time[1]+10*time[0];

This won't work because the digits are characters. You need to subtract '0' from them to get the numeric representation:

ss=10*(time[6]-'0')+(time[7]-'0');
mm=10*(time[3]-'0')+(time[4]-'0');
hh=10*(time[0]-'0')+(time[1]-'0');

Note that I also fixed the equations to do what you intended.

time=hh+mm/60+ss/3600;

This is completely nonsensical because you're trying to assign the value of an integer to a string. There's no automatic conversion, so you'll get garbage.

Finally, the calculation is confusing because minutes and seconds will always be 0. The largest value of mm and ss will be 59, assuming you're validating the usual hh:mm:ss format. 59/60 is 0, and 59/3600 is 0, so the result of hh+mm/60+ss/3600 is equivalent to hh even with the largest possible values of mm and ss :

#include <iostream>
#include <string>

using namespace std;

int main()
{
    string time("10:59:59");
    int ss, mm, hh;

    ss=10*(time[6]-'0')+(time[7]-'0');
    mm=10*(time[3]-'0')+(time[4]-'0');
    hh=10*(time[0]-'0')+(time[1]-'0');

    cout << hh + mm / 60 + ss / 3600 << '\n';
}
Narue 5,707 Bad Cop Team Colleague

I tried to fix the bold and declared it, but when I declare it, other errors show up. I don't get it. How do I fix this?

What errors are you getting? :icon_rolleyes:

>> omp_get_max_threads ( ) Spacing issue I think. Try omp_get_max_threads( )

Whitespace is largely insignificant in C++, your suggestion won't change anything.

Narue 5,707 Bad Cop Team Colleague

Attention: rtrim could modify memory outside string range

While you're correct, the bug report is unhelpful because you haven't specified when this would happen or suggested a fix. The problem stems from an unchecked decrement of original , which can drop below string if it's empty of contains nothing but junk characters.

If whatever memory prior to string also contains junk characters, the loop will continue and modify memory outside the bounds of the array. If memory prior to string doesn't contain junk characters, at least one element beyond the array will be accessed, which is still undefined behavior.

Trimming away the entire string is the special case that needs to be considered here, with awareness of three potential cases at original[0]:

  • original[0] is '\0': The string was empty, so nothing needs to be done.
  • original[0] is junk : The string is trimmed to nothing and must end at original[0] .
  • original[0] neither '\0' nor junk : The string must end after original[0] , as in the original algorithm.

Once the potential cases are discovered, it's a simple matter to account for them:

char *rtrim(char *string, char junk)
{
    char *original = string + strlen(string);

    while (original != string && *--original == junk)
        ;
    
    if (*original != '\0')
        original[*original == junk ? 0 : 1] = '\0';

    return string;
}
~s.o.s~ commented: Nice follow-up; can't believe I missed Melando's post :-) +17
Narue 5,707 Bad Cop Team Colleague

That seems kind of silly to me. The point of a checksum is to verify the legitimacy of a file after downloading it. If you're getting the checksum before downloading the file it's no different from taking on faith that the file is legit in the first place.

Narue 5,707 Bad Cop Team Colleague

The if statement is correct in that it finds exactly what you're looking for. The problem is that the element isn't what has the value you want. That's the text element contained by the node. The following will work, though it has a hackish feel:

XmlTextReader textReader = new XmlTextReader(Application.StartupPath + @"\config.xml");
textReader.Read();
while (textReader.Read()) {
    if (textReader.NodeType == XmlNodeType.Element && textReader.Name == "name") {
        textReader.Read();
        _unselected.Add(textReader.Value);
    }
}

I'd prefer an xpath approach simply because it's cleaner:

var doc = new XmlDocument();

doc.Load(Application.StartupPath + @"\config.xml");

foreach (XmlElement match in doc.SelectNodes("//software/name"))
    _unselected.Add(match.InnerText);
Narue 5,707 Bad Cop Team Colleague

1) <iostream.h> is an old style header that's no longer supported by modern compilers. Your compiler is correct in forcing you to use the standard <iostream> header, which also wraps everything in the std namespace.

2) Your question is nonsensical. Please provide an example of using pointers that's improved with a global array.

Narue 5,707 Bad Cop Team Colleague

Do you need to retain the original order? The standard library has a set_intersection() function that does what you want, but both sets need to be sorted:

#include <algorithm>
#include <iostream>
#include <iterator>

using namespace std;

template <typename T, int N>
int size(T(&)[N]) { return N; }

int main()
{
    int a[] = {1,2,2,3};
    int b[] = {3,5,1,2};
    
    sort(a, a + size(a));
    sort(b, b + size(b));
    
    set_intersection(a, a + size(a), b, b + size(b), ostream_iterator<int>(cout, " "));
    cout << '\n';
}

Without the ordering requirement, the linear intersection algorithm doesn't work. The naive non-ordered algorithm uses a more brute force (and thus less efficient) approach with nested loops:

for i = 0 to size(a)
    for j = 0 to size(b)
        if b[j] = a[i] and not contains(c, a[i])
            append(c, a[i])
        end if
    loop
loop
Narue 5,707 Bad Cop Team Colleague

I searched all over the net trying to find the reason behind why numbers are illegal as first characters in naming identifiers in C++, they say its illegal but they don't say why its illegal

Leading digits would be confused with numeric literals. If you allow leading digits then that would require further restrictions on subsequent characters to ensure that the literal logic doesn't find a false positive, which complicates the language definition on top of complicating the compiler by making it do unnecessary validation.

Narue 5,707 Bad Cop Team Colleague

but I'm not an analytic person nor good in designing..

Experience and effort often trumps natural talent. As long as you enjoy what you do, lack of talent shouldn't stop you from trying.

Narue 5,707 Bad Cop Team Colleague

if you aren't providing constructive criticism nor helping, don't post.

I did help you. You simply didn't accept it. I won't make the same mistake again.

Now allow me to help you, Julienne.

http://www.daniweb.com/forums/faq.ph...niweb_policies

If any of those rules are unclear to you, I'll be happy to explain them. Interpretation and enforcement of the rules are part of my job as community admin, after all. :)

Narue 5,707 Bad Cop Team Colleague

1. What is your definition of management?

The task of keeping team members focused and sufficiently insulated from external concerns to facilitate the doing of their jobs.

2. Do you utilize the four functions of management( planning, organizing, leading, and controlling) and which do you feel is most important?

While I'm sure I do use the four functions of management in some form or another, it's not really a conscious choice. Rather the "functions" of management consist of whatever it takes to keep things running smoothly.

3. How do you deal with conflict between employees?

It depends on the conflict. I've reorganized slightly when personalities conflict, offered as little as a minor scolding, and gone as far as terminating employees due to conflicts. It's all very specific to the situation.

4. How is your company organized? Do you support a flexible or more formal organizational approach?

Flexible. I've found that formalities are more of a hindrance than a help.

5. How do you utilize self managed teams?

I let them manage themselves and only step in when things begin to break down or require an outside perspective.

6. How do you utilize empowerment?

I've never utilized "empowerment", but I suspect it would work well as a buzz word in press releases. :icon_rolleyes:

7. What are the primary obstacles you face to be successful?

I manage developers, and it's a tricky process feeding egos just enough to keep everyone happy without it getting out of …

Narue 5,707 Bad Cop Team Colleague

Ye the only error being that the compiler stalls or hangs. Thanks for your help.

OK then, post a complete test program that exhibits the problem, including whatever test input you're using, because I cannot reproduce it.

Narue 5,707 Bad Cop Team Colleague

Hmm, I'd say that a good solution is to rewrite your reverseString() entirely so that it builds the reversed string rather than tries to fill a caller provided object:

#include <iostream>
#include <string>

using namespace std;

string reverseString(string::const_iterator first, string::const_iterator last)
{
    if (first == last)
        return string();

    return reverseString(first + 1, last) + *first;
}

int main()
{
    string userString;

    cout << "Please enter a string you would like to see reversed." << '\n';
    cout << "Enter a string: ";
    
    if (getline(cin, userString)) {
        string reversed = reverseString(userString.begin(), userString.end());
        
        cout << "The contents of the string you entered is: " << userString << '\n';
        cout << "The contensts of the reversed string is: " << reversed << '\n';
    }
}

Greatly simplified, no?

Narue 5,707 Bad Cop Team Colleague

I still get the same kind of error when I compile

The error being that the sort still hangs? Because you explicitly stated before that there were no compilation errors or warnings. Assuming strcomp() is equivalent to the standard strcmp(), this works fine for a few simple tests:

void Quicksortfirst(Contact *person, int left, int right)
{
    int L = left;
    int	R = right;
    char pivot[maxstring];
    strcpy(pivot, person[(left+right)/2].first);
    while(L <= R) {
        while (strcmp(person[L].first, pivot)<0) {
            L++;
        }
        while (strcmp(person[R].first,pivot)>0) {
            R--;
        }
        if (L <= R) {
            swap(person[L], person[R]);
            L++;
            R--;
        }
    }
    if (left < R) {
        Quicksortfirst(person, left, R);
    }
    if (L < right) {
        Quicksortfirst(person, L, right);
    }
}
Narue 5,707 Bad Cop Team Colleague

Look closely at these two loops and find the difference (aside from int vs string):

while (person[L].number < pivot){
    L++;
}
int diff1 = strcomp(person[L].first, pivot);

while (diff1<0){
    L++;
}

If you didn't see it, when does diff1 change inside the loop?