- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I want to invoke abs() function in NiosII.
But i find this function does not defined. Which header file should I include? or I should implement it by myslef?Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It should be there, as a part of newlib. Try including stdlib.h and see if that works.
Here's a brief description from a website I found:Synopsis
# include <stdlib.h>
int abs(int i);
Description
abs returns the absolute value of i (also called the magnitude of i). That is, if i is negative, the result is the opposite of i, but if i is nonnegative the result is i.
The similar function labs uses and returns long rather than int values.
Returns
The result is a nonnegative integer.
Portability
abs is ANSI.
No supporting OS subroutines are required.
- slacker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's OK.
abs() is working now when i add <stdlib.h> . THX!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page