• Register
1 vote

Problem :

I am currently doing an exercise from the textbook and the book is very outdated, so I am tring to figure out how it really fits into the current system as you go along. Following is the exact text but  it is returning error

'Implicit conversion loses integer precision: 'time_t' (aka 'long') to 'unsigned int''.

It is on this srandom(time(NULL)); line.

If I try to replace time with time_t, then it comes up with another error message as below :

Unexpected type name 'time_t': unexpected expression.

I have no idea what either of them mean. The question which I read with the same error was apparently something trying to do with 64- and 32- bit integers but, actually, I don't know what that actually means. How to fix this error?

6 5 3
7,540 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

It is just the notification. You are trying to assign the 'long' to 'unsigned int'

So the solution is very simple. You need to just click the yellow notification icon on your left ribbon of that particular line where you are trying to assign that value. So it will just show a solution. Double click on the shown solution and it will do everything automatically.

It will just typecast to match the equation. And this fixes your issue.

9 7 4
38,600 points

Related questions

0 votes
1 answer 43 views
Problem: Hello Kodlogs, Playing my way around with this code contact_list = [ {"name" => "jack", "phone_number" => "6789"}, {"name" => "Tracy", "phone_number" => "2345"} ] contact_list.each do |contact| puts "Contact: #{contact_list["name"]} and ... : #{contact_list["phone_number"]}" end It returns: no implicit conversion of String into Integer (TypeError) How do I correct this I'm confused?
asked Nov 8, 2020 Festus James 360 points
0 votes
1 answer 385 views
Problem: I am very new to Java and trying to learn arrays in Java. I am trying to enter one int and the other long ex: 1 and 1000000000 and now I am trying to create the array of size 1000000000. And after creating the array at each index of my array willing to store int val, ex: arr[ ... [1]);     long []arr;        arr = new long[y+1];         for(long j=0;j<=y;j++)         arr[j] = 4;     }
asked Jul 29, 2020 Raphael Pacheco 4.9k points
1 vote
1 answer 91 views
Problem: I have very recently started with the iOS development and I am currently learning the use of NSData using the Obj-C. Currently I am trying to use the URLSession:dataTask:didReceiveData method to get the NSData by using the HTTP POST request. My server should ... (@"json error: %@", [error localizedDescription]); } } Please guide me if anyone knows the potential reason behind this problem?
asked Jun 1, 2020 Martin K 6.6k points
1 vote
1 answer 405 views
Problem : I have the big trouble with the iOS App: it just crashes sometimes without detailed debug error. The stack trace is also empty. Below are the only two lines in the stack trace: 1. Crash start in UIApplicationMain at "symbol stub for: - ... breakpoint in malloc_error_break with the libsystem_c.dylib without any feedback from the debugger. I have no idea regarding how to solve this issue.
asked Dec 16, 2019 alecxe 7.5k points
0 votes
1 answer 624 views
Problem : I have a serious issue with my iOS App: it crashes manytimes without detailed debug error. My stack trace is empty. Below are the only two lines in my stack trace: a. Crash start in UIApplicationMain at "symbol stub for: -[ ... breakpoint in malloc_error_break with the libsystem_c.dylib but without any feedback from debugger. I have no idea how can I solve this issue.
asked Dec 7, 2019 alecxe 7.5k points
0 votes
1 answer 28 views
I got a list of numbers in the range 0-1023. I want to convert them to integers such that 1023 maps to -1, 1022 maps to -2 etc.. while 0, 1, 2, ....511 remain unchanged. I came up with this: def convert(x): return (x - 2**9) % 2**10 - 2**9 is there a more better way?
asked Oct 29, 2020 psandprop 2.4k points
0 votes
1 answer 3 views
Can someone please help me? I would most appreciate it. Thank you very much in advance
asked 3 days ago TeamScript 11.1k points
0 votes
1 answer 6 views
Problem: I am currently working through Accelerated C++ and have come across an issue in exercise 2-3. A quick overview of the program - the program basically takes a name, then displays a greeting within a frame of asterisks - i.e. Hello ! surrounded framed by *'s. The ... . They then ask the reader, as part of the exercise, to ask the user for input as to how big they want the padding to be
asked Dec 13, 2020 Mashhoodch 6.7k points
1 vote
1 answer 48 views
Problem : I am very new to C++ programming. I am facing below error if I try to execute my code. Please find below the error: Warning: comparison between signed and unsigned integer expressions . Please find below my erroneous code: vector<long int> row;     long n,m;     long ... ;i<row.size();i++) I am looking for quick fix for my above error can some c++ expert help me in fixing above error ?
asked Apr 25, 2020 stewart 4k points
0 votes
2 answers 1.7K views
Problem : While I am running the python code on windows with python 3.5 64 bit. Getting below error. overflowerror: python int too large to convert to c long
asked Oct 22, 2019 peterlaw 6.9k points