language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
#include<stdlib.h>
#include <time.h>
struct Page
{
int page_no;
}frames[7];
int faults=0,q,p,n,page_no,flag=0;
int page_found(int page_no)
{
for(q=0;q<n;q++)
{
if(frames[q].page_no == page_no)
return q;
}
return 'a';
}
int main()
{
int len;
srand ( time(NU... |
C | #include <signal.h>
#include <unistd.h>
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
//using namespace std;
//int main()
//{//3.如果多线程模型中,一个线程有异常,比如1/0,这时候这个程序会怎么样?
// 如果是发信号,是哪个线程发送的信如果出现这种情况,应该怎么处理?
// void bbb(int t)
//void *bbb()
//{
/... |
C | #include<stdio.h>
#include<stdlib.h>
//Node to store data of type int
struct Node{
int data;
struct Node *next;
};
//Node to store Address
struct Stack{
struct Node *data;
struct Stack *next;
};
struct Node *head=NULL;
struct Stack *stackhead=NULL;
struct Node *createNode(int data);
void show();
int isEmpty();
v... |
C | #include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include "eps.h"
int main()
{
char * file_path = "out.eps";
char * consoleCommand = "xdg-open ";
int width = 1500;
int height = 3200;
float square_scale = 6.0f;
FILE * file_ptr = fopen(file_path, "w+");
setHeader(file_ptr, "Sorting... |
C | #include "internal.h"
/// <summary>
/// Downscale the image by half and write the result to the output.
/// </summary>
/// <param name="image"> IN: Image to downscale. </param>
/// <param name="output"> OUT: Downscaled image. </param>
/// <returns> 1 IF generation was successful, ELSE 0. </returns>
int ethsift_downsc... |
C | #include <gb/gb.h>
#include <stdio.h>
#include "sprites.c"
struct Box {
int size;
int x;
int y;
int vx;
int vy;
};
void updatePoint(struct Box *b) {
b->x += b->vx;
b->y += b->vy;
if (b->x > SCREENWIDTH - b->size || b->x < 0) {
b->vx = b->vx * -1;
}
if (b->y ... |
C | #include <unistd.h>
void ft_print_alphabet(void)
{
write(1, "abcdefghijklmnopqrstuvwxyz", 26);
}
void ft_print_alphabet_1(void)
{
char i = 'a';
while (i <= 'z')
{
write(1, &i, 1);
i++;
}
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parsing.c :+: :+: :+: ... |
C | int main(){
double r,pi=3.141592653589;
scanf("%lf",&r);
printf("%lf %lf\n",pi*r*r,2*pi*r);
return 0;
}
|
C | #include <product.h>
#include "button.h"
#define BUTTON_PORT (GPIOA)
#define BUTTON_PIN (0)
#define BUTTON_GPIOMODER_MASK (GPIO_MODER_MODER0_0 | GPIO_MODER_MODER0_1)
#define BUTTON_RCCEN (RCC_AHB1ENR_GPIOAEN)
// private filds
static button_mode buttonMode = BUTTON_MODE_MAX;
stat... |
C | #include <stdio.h>
#define MAXLINE 1000
#define YES 1
#define NO 0
char OPENERS[4] = {'(', '{', '[', '\0'};
char CLOSERS[4] = {')', '}', ']', '\0'};
int getline2(char line[], int maxline);
int push(char value);
int index_in_list(char options[], char ch);
char pop();
char top();
int is_empty();
char stack[MAXLINE];
... |
C | #include <linux/engineer_debugs.h>
//获取链表中的某个调试项的节点,num表示第几个
debug_list* engineer_debugs_find_option(const debug_list *head,short num)
{
debug_list *aim = head;
//为0或小于0处理----
num--; //列表从1开始,最小为1
printk("[px_test]enter %s\n",__func__);
while(num--)
{
aim = aim->next;
}
return aim;
}
int eng... |
C | #ifndef SPT_LINKEDLIST_H
#define SPT_LINKEDLIST_H
#include "spt_linkedlist_struct.h"
/* Creates an spt_linkedlist in memory and returns a pointer to it
*
* @param node The first node in the new spt_linkedlist
* @return A pointer to a newly created spt_linkedlist with node as its
* first node
*/ ... |
C | #include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <float.h>
struct Client
{
int id;
float balance;
int gender; // 0: M, 1: F
};
float average_by_gender(struct Client *clients, int gender)
{
float sum = 0.0;
int len_of_gender = 0;
for (int i = 0; i < sizeof(*clients)/sizeof(st... |
C | /*ch6 sum.c*/
#include <stdio.h>
#include <stdlib.h>
int main(){
int number;
int total=0,item=1;
printf("%d. Input a number to be sumed:\n",item);
while(scanf("%d",&number)==1){
total=total+number;
printf("%d. Input a number to be sumed : \n",++item);
}
item--;
printf("\nThere are %d numbers entered,\n",item... |
C | #include<stdio.h>
#include "struct.h"
#include "array.h"
/**
* Hlavni program.
*/
int main()
{
printf("STRUKTURY\n------------\n");
// vytvoreni objektu
Object o1 = object_ctor(10,"Alice");
Object o2 = object_ctor(20,"Petr");
// vypiseme objekty
print_object(&o1);
print_object(&o2);
printf("----------... |
C | /**
* @file act1.c
* @author NIVESH (you@domain.com)
* @brief
* @version 0.1
* @date 2021-04-30
*
* @copyright Copyright (c) 2021
*
*/
#include <avr/io.h>
#include "act1.h"
void act1()
{
DDRB |= (1<<PB0);//set the bit PB0
DDRC &= ~(1<<PC0);//clear the bit PD0
DDRD &= ~(... |
C | #define _GNU_SOURCE
#include "helpers.h"
#include <sys/wait.h>
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <signal.h>
#define RERROR(_X) \
if (_X == -1) { \
int old_trigger = sigint_catched_runpipe; \
if (sigint_catched_runpipe == 0) {... |
C | /**
* start_hp.c
*
* opening screen handler
*/
#include "start_up.h"
#include "../text/text.h"
#include "../battle/battle.h"
#include "../assets/sprite_palette.h"
#include "../assets/bkg_palette.h"
#include "../assets/level_assets/level_assets.h"
/* actions that can be taken and returned */
UINT8 GAME_OVER = 0;
... |
C | #ifndef _HISTOGRAM_TYPE_H
#define _HISTOGRAM_TYPE_H
/* The functions here come from GSL libaray */
struct histogram {
size_t n ;
double * range ; /* size of range should be size of bin + 1 */
double * bin ;
};
void free_histogram(struct histogram* h)
{
if(h)
{
if(h->range)
free... |
C | // ABC061 B - Counting Roads
#include <stdio.h>
int main(void) {
int N, M;
int roads[51] = { 0 };
scanf("%d %d", &N, &M);
for (int i = 0; i < M; i++) {
int a, b;
scanf("%d %d", &a, &b);
roads[a] += 1;
roads[b] += 1;
}
for (int i = 1; i <= N; i++) {
printf... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/epoll.h>
#include <string.h>
#include <errno.h>
#include<unistd.h>
#include<sys/epoll.h>
#define MAX_EVENTS 5
#define READ_SIZE 10
int main(){
int running =1, event_count, i;
size_t bytes_read;
char read_buffer[READ_SIZE+1];
struct epoll_even... |
C | #include "UserManage.h"
/*
*注册账号
*参数:用户信息指针
*成功:0,失败:-1
*/
int register_user(user_info* info)
{
if(!info) {
printf("param is NULL in %s\n", __func__);
return -1;
}
if(sqlite3_insert(info) != 0){
printf(" register user failed\n");
return -1;
}
return 0;
}
/**
... |
C | #include <stdio.h>
int main(int argc, char *argv[])
{
int a, b = 2, c = 5;
for(a = 1; a < 4; a++)
{
switch(a)
{
b = 99; // 永远不会被用到
case 2:
printf("c is %d\n", c);
break;
default:
printf("a is %d\n", a);
... |
C | /*
spamdyke -- a filter for stopping spam at connection time.
Copyright (C) 2015 Sam Clippinger (samc (at) silence (dot) org)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
Th... |
C | #include <stdio.h>
int main()
{
int marks;
printf("Please enter your marks: ");
scanf("%d", &marks);
if (marks >= 80){
printf("Your grade is A+!\n");
}
else if (marks >= 70){
printf("Your grade is A!\n");
}
else if (marks >= 60){
printf("Your grade is A-!\n");
... |
C | #include "controller.h"
#include "zone_monitor.h"
#include "relay.h"
#include "furnace_power_sensor.h"
#include <string.h>
static uint16_t timer_remaining; // in seconds
static void (*msg_sender)(const void *data, const size_t data_len);
void furnace_controller_init(
void (*msg_sender_fn)(const void *data, cons... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test.c :+: :+: :+: ... |
C |
int main(int argc, char* argv[])
{ int i,len,n;
char str[256],str2[256];
scanf("%d",&n);
while(n>0)
{
scanf("%s",str);
len=strlen(str);
for(i=0;i<len;i++)
{
if(str[i]=='A')
str2[i]='T';
if(str[i]=='T')
str2[i]='A';
if(str[i]=='C')
str2[i]='G';
if(str[i]=='G')
s... |
C | /*--------------------------------------------------------------------- *
* Arquivo: moveServo.c *
* Criador: João Pedro Melquiades Gomes Mat: 118110077 *
* Descrição: Arquivo com a definição da função moveServo() *
*--------------------------------------------------------------------- */... |
C | #include <stdio.h>
#include <stdlib.h>
#include "pcx.h"
void read_header(FILE *fp) {
PCX_Header header;
fread(&header, sizeof(PCX_Header), 1, fp);
}
RGBColor* read_palette(FILE *fp) {
fseek(fp, -768, SEEK_END);
RGBColor *extended_palette = malloc(256 * 3);
fread(extended_palette, 3, 256, fp);
return ex... |
C | /*
* mm-naive.c - The fastest, least memory-efficient malloc package.
*
* In this naive approach, a block is allocated by simply incrementing
* the brk pointer. A block is pure payload. There are no headers or
* footers. Blocks are never coalesced or reused. Realloc is
* implemented directly using mm_malloc an... |
C | #include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <michel_getdpids.h>
#define LEN 14 /* buffer size, in PIDs (can't be > 14) */
int main(int argc, char** args) {
pid_t pid, cpid; /* PIDs */
pid_t dpids[LEN]; /* buffer for descendant PIDs */
int i, r; /* control vars */
printf("Test 1 - Singl... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include "library.h"
#include "liballoc.h"
#include "libinout.h"
#include "global.h"
int compare ( const void *pa, const void *pb )
{
const int *a = *(const int **)pa;
const int *b = *(const int **)pb;
return a[ID_COL] - b[ID_COL];
}... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int *Data;
double START, END;
void insertionsort(int *seq, int size) {
for (int j = 1; j < size; j++) {
int key, i;
key = seq[j];
i = j - 1;
while (i > -1 && seq[i] > key) {
seq[i + 1] = seq[i];
i--;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "SLL.h"
NodeT *search(NodeT *head, int givenKey)
{
//TODO: search the given key and return the first node containing it or NULL
NodeT *p = head;
while(p != NULL)
{
if(p->key == givenKey)
return p;
else
p = p->next;... |
C | // { dg-do assemble }
// Make sure we make the right unqualified class a friend
// See PR c++/4403
template <class T> struct A
{
struct AA;
struct AC;
};
template <class T> class B
:public A<T>
{
friend struct B::AA; // OK, this has an implicit typename
// as if it is 'friend struct typename B::AA'
... |
C | /* 29-time.c --- time */
#define _XOPEN_SOURCE 700
#define _DEFAULT_SOURCE /* tm_gmtoff, tm_zone */
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <assert.h>
int
main()
{
/* 日历时间 */
struct timeval tv;
if (gettimeofday(&tv, NULL) == -1) {
perror(... |
C | #include <stdio.h>
#include <stdlib.h>
int a=0;
int suma(int num1, int num2){
return num1+num2;
}
int resta(int num1, int num2){
return num1-num2;
}
int multiplicacion(int num1, int num2){
return num1*num2;
}
int division(int num1, int num2){
return num1/num2;
}
void todasLasFunciones(int num1, int num... |
C | // modele implicite
/* BORDET Dennis */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glpk.h> // nous allons utiliser la bibliothèque de fonctions de GLPK
/* Déclarations pour le compteur de temps CPU */
#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
/*
#define nbvilles N
#d... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
float nota1, nota2, nota3, nota4, media;
nota1 = nota2 = nota3 = nota4 = media = 0;
printf("\t\t\t\t Media Escolar 1.0\n");
printf("Digite sua primeira nota bimestral:\n");
scanf("%f", ¬a1);
printf("Digite sua segunda nota bimestral:\n");... |
C | /*
** EPITECH PROJECT, 2018
** PSU_42sh_2017
** File description:
** Cd builtins functions.
*/
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "shell.h"
#include "instruction.h"
#include "execution.h"
#include "mylib.h"
static unsigned int clear_folder_name(c... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
struct process{
int pid;
int arr_time;
int burst_time;
};
int n;
typedef struct process Process;
int proc_arrives(int i, Process ps[]){
for(int k = 0; k<n; k++){
if(ps[k].arr_time == i)
return ps[k].pid;
}
return 0;
}... |
C | #include <stdio.h>
int main(){
int m,n;
char ch;
//clrscr();
y:printf("Key-in two numbers: ");
scanf("%d%d", &m,&n);
printf("The first number is %d\n",m);
printf("The second number is %d\n",n);
printf("The addition of the two numbers is: %d+%d=%d\n",m,n,m+n);
printf("\n Would you like to do more addit... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <signal.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXBUF 1024
int main(int argc, char *argv[]) // char ** argv
{
int server_sockfd, client_sock... |
C | #include <stdio.h>
int main(){
char entrada;
int forca, T;
scanf("%c\n%d", &entrada, &forca);
if(entrada == 'c') T = 18;
else T = 20;
int poder = ((forca * T) - 80)/10;
if(poder < 150){
printf("Fraco, nem passou");
}else if(poder < 180){
printf("Perfeito");
}else if(poder < 210){
printf("Satisfe... |
C | #include <stdio.h>
int factorial(int n) {
// 해당되는 팩토리얼 파트를 구성하시오
}
int main() {
printf("Factorial Result (5!) = %d\n",factorial(5));
return 0;
}
// Main 함수에는 손을 대지 마시오
// Factorial 함수를 완성하여 5! = 120 이라는 결과값이 나오게 출력하시오
// 메인 함수에서 입출력을 해서 변형을 해도 좋음 |
C | #include <stdio.h>
int main() {
//Declarao
int num;
printf ("Digite um nmero inteiro: ");
fflush (stdout);
scanf ("%d", &num);
if (num > 100) {
printf ("%d", num);
} else {
num = 0;
printf ("%d", num);
}
}
|
C | /* SPDX-License-Identifier: GPL-2.0 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "kselftest.h"
struct test {
const char *const name;
const char *cons... |
C | #include "RoketLink.h"
#include <assert.h>
void manual_assignment_test();
void test_altitude();
void test_latitude();
void test_longitude();
void test_pressure();
void test_temperature();
void test_tracker_yaw();
void test_tracker_pitch();
void test_payload_roll();
void test_payload_pitch();
void test_pa... |
C | #ifndef MINI_RPG_EVENTPACKAGE_H
#define MINI_RPG_EVENTPACKAGE_H
struct EventPackage {
enum Type {
MOVE_PLAYER, PLAYER_ATTACK, CHANGE_PLAYER, SELECT_PLAYER, VIEW_STATS,
QUIT, RESET, EXIT_SPECIAL_SCREEN, QUICK_ACCESS
};
EventPackage() {};
EventPackage(Type t) : type(t){};
EventPackag... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/shm.h>
#include <sys/msg.h>
#include "log_write.h"
#include "message.h"
#include "equipment.h"
#include "power_system.h"
void log_write_handle(FILE *log_server, int shmid_equipment, int shmid_system, int msqid)
{
message_t got_msg;
equip_t *equi... |
C | #include <stdio.h>
#include "../include/list_def.h"
void list_close(list_data* list)
{
lst_assert(list);
lst_check(list,);
pthread_mutex_destroy(&list->mutex);
free_list_item(list->root);
if(list->root)
{
if(list->subdir)
{
if(list->root->dirct_num)
... |
C | #include<stdio.h>
#include<conio.h>
#include<math.h>
void main(){
/*
nhap n
*/
int n,tu=1,mau =0,i=1;
float sum=0;
printf("nhap n = ");
scanf("%d", &n);
while(i<=n){
mau= mau+i;
sum=sum + (float)tu/mau;
i++;
}
printf("in ra man hinh s = %f", sum);
}
|
C | /*
16. Write a program to send and receive data from parent to child vice versa. Use two way communication.
*/
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
int pipe_parent[2];// from parent to child
int pipe_child[2];// fr... |
C | #include "helpers.h"
#include <stdio.h>
#include <math.h>
// Convert image to grayscale
void grayscale(int height, int width, RGBTRIPLE image[height][width])
{
float avg;
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
avg = (image[i][j].rgbtBlue + image[i][... |
C | /*
两种构建最大堆的方法:
1. 将元素一个一个Insert进堆中
2. 先把所有元素依次加入到完全二叉树中, 再调用MakeMaxHeap调整成堆
*/
#define INFINITE 1<<30
typedef int bool;
typedef int ElementType;
typedef struct HeapStruct *MaxHeap;
struct HeapStruct
{
ElementType *Elements; //存储堆元素的数组
int size; //堆中当前元素个数
int capacity; //堆的最大容量
};
/*创建一个空堆*/
MaxHeap Create... |
C | #include <stdio.h>
main() {
char inp[50];
char *rev;
int i, j=100,h;
char temp;
printf("Enter a line of text : ");
scanf("%[^\n]" ,inp);
printf("%s" ,inp);
j=(int) strlen(inp);
rev=(char *)malloc(j+1);
h=j;
for(i=0;i<h;i++) {
rev[i] = inp[j-1];
j--;
}
rev[i] = '\n';
printf("Here is the reversed veri... |
C | /* Computer DJ */
#include <stdio.h>
char music[27][102];
int sum[50];
void newl() {
char ch;
while ((getchar() != '\n') && (ch != EOF));
}
int getint() {
int ch, i, sign = 1;
while (((ch = getchar()) == ' ') || (ch == '\n'));
if (ch == EOF) return (EOF);
for (i = 0; ch >= '... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
double c, c1;
int c2,c3;
printf("Conversor de Fahrenheit para Graus Celsius \n");
printf("Digite o numero a ser convertido: \n");
scanf("%f", &c1);
c=(c1-32.0) * (5.0/9.0);
printf("A conversao %.f Fahrenhit para graus Celsius eh igual a ... |
C | /*************************************
* Lab 3 Exercise 1
* Name: Jerrell Ezralemuel
* Student No: A0181002B
* Lab Group: 08
*************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h> // For Predefined constants
#include <sys/ipc.h> // Fo... |
C | // use hash ?? to find the next biggest ???
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* prevPermOpt1(int* A, int ASize, int* returnSize)
{
*returnSize = ASize;
int min = 10001;
int s[10001] = {0};
for (int i = ASize - 1; i >= 0; i --)
{
int c = A[i]... |
C | #include <stdio.h>
#include <time.h>
int main(int argc, char const *argv[])
{
long int second_since_epoch;
struct tm current_time, *time_ptr;
int hour, minute, second, day, month, year;
second_since_epoch=time(0); // передает значение ,сколько прошло с начала эры,так сказать
printf("time() секунд... |
C | /*Задача 9. Направете функця add(), която събира две точки.*/
#include <stdio.h>
struct point
{
int x;
int y;
};
void addPoints(struct point *a, struct point *b, struct point *c)
{
c->x = a->x + b->x;
c->y = a->y + b->y;
}
int main()
{
struct point a = {0, 5}, b = {3, 2}, c;
addPoints(&a, &b, &... |
C | #include "scrollconsole.h"
#include <stdlib.h>
#include <string.h>
#include <tilesense.h>
ScrollConsole scrollconsole_new() {
return calloc(1, sizeof(struct _scroll_console));
}
ScrollConsole scrollconsole_init(ScrollConsole sc, int w, int h) {
sc->w = w;
sc->h = h;
sc->cons = TCOD_console_new(w, h);
sc->lin... |
C | // Copyright © 2021 Kris Nóva <kris@nivenly.com>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable l... |
C | #include "stego.h"
// reads the PGM file and fills in the values for image
void
readImage( char fileName[], Image *image )
{
FILE *in = fopen( fileName, "rb" );
if( in == NULL )
error( "File was not opened correctly!");
char buffer[100];
if( fgets( buffer, 100, in ) == NULL )
error( "Error reading magic number... |
C | #include <quicksort.h>
#include <assert.h>
void fill_test_data(int v[], int n) {
int i;
srandomdev();
for (i = 0; i < n; i++) {
v[i] = random();
}
}
int is_sorted(int v[], int n) {
int i;
for (i = 1; i < n; i++) {
if (v[i - 1] > v[i]) {
return 0;
}
}
... |
C | #include<stdio.h>
#include<string.h>
int abc(char ar[1009])
{
int a,b,c,d,i,j,k;
d=strlen(ar);
c=0;
k=1;
b=0;
a=0;
for(i=0;i<d;i++){
if(ar[i]=='('){
c++;
a++;
}
if(ar[i]==')'){
c--;
b++;
if(c<0){
... |
C | // Implement the Queues with structures pointers
#include <stdio.h>
#include <stdlib.h>
struct queue
{
int q[20];
int head;
int tail;
int max;
};
int main() {
struct queue *q;
q = (struct queue *) malloc(sizeof(struct queue));
q->head = -1;
q->tail = -1;
printf("Input the size of ... |
C | #include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sqlite3.h>
#include <unistd.h>
#include "sensor_db.h"
/* when DB connection fails we wait a bit
* then reconnect, after 3 attempts we close
*/
#define conn_attempt_wait 0.3
/*If the table existed, clear up the existing data if clear_up_flag is se... |
C | #ifndef __MULLINSN__TODO__
#define __MULLINSN__TODO__
//will close the file, print an error msg and then exit
void exitWithError(char* line, FILE* f);
//parse through the file and load the ints into an array
void parseFile(char arr[20][10][3]);
//swap a with b
void swap(int* a, int* b);
//perform downheap on ... |
C | #include "monty.h"
/**
* pop - This removes the top element of the stack.
* @command: This is data we are accessing from the command.
*
* Return: Void.
*/
void pop(command_t *command)
{
stack_t **head = command->head;
stack_t *the_removed = NULL;
if (head == NULL || *head == NULL)
{
printf("L%d: can't pop... |
C | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
void hicm()
{
float no,nocov;
printf("Enter your height :");
scanf("%f", &no);
nocov=no/30.48;
printf("\nYour height in feet is %f",nocov);
}
void hift()
{
float no,nocov;
printf("Enter your height :");
scanf("%f", &no);
nocov=no*30.48;
printf("\nYour hei... |
C | #include<stdio.h>
#include <stdlib.h>
struct A
{
int x;
char *str; // (or) char str[20];
};
main()
{
struct A a1 = { 101, "abc" } , a2;
a1.x=10;
a1.str="hello"; //works?:-when we used array this not works array assignment used only integer value.
scanf("%d%s",&a1.x,a1.str); //works?:- when we used pointer this not wor... |
C | #include "genresult.cuh"
#include <sys/time.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct{
int row;
int num;
}rowstruct;
typedef struct ohyah{
int index;
struct ohyah * next;
}list;
int cmpfunc (const void * a, const void * b)
{
rowstruct * ap = (rowstruct *)a;
rowstruct * bp = (rowstruct *)b;
... |
C | #include<stdio.h>
int main()
{
int l=0,i,n,a;
printf("entr limit");
scanf("%d",&n);
printf("entr nmbr");
for(i=1;i<=n;i++)
{
scanf("%d",&a);
if(a>l)
l=a;
}
printf("\n largst nmbr= %d ",l);
}
|
C | #include <stdio.h>
#include <stdlib.h> // malloc, free Լ
struct Phone { // ȭ ü
int areacode; // ȣ
unsigned long long number; // ȭ ȣ
};
struct Person { // ü
char name[20]; // ̸
int age; //
struct Phone phone; // ȭ. ü
};
int main()
{
... |
C | #include "device_functions.h"
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/gpio.h>
#include <libopencm3/stm32/flash.h>
#include <libopencm3/stm32/pwr.h>
/* Function to Initialise all GPIOs */
void vGPIOInitialize() {
/* Enable GPIOC clock. */
rcc_periph_clock_enable(RCC_GPIOB);
/* System ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | // SKIP PARAM: --set ana.activated[+] "'file'" --enable ana.file.optimistic
#include <stdio.h>
int main(){
FILE *fp1;
fp1 = fopen("test1.txt", "a");
fprintf(fp1, "Testing...\n");
FILE *fp2;
fp2 = fopen("test2.txt", "a");
fprintf(fp2, "Testing...\n");
FILE *fp;
int b;
if(b){
fp = fp1;
}else{
fp = fp2;... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct No
{
float payload;
struct No* prox;
} No_t;
typedef struct
{
struct No* inicio;
struct No* fim;
} Fila_t;
Fila_t* criar(void)
{
Fila_t* fila = (Fila_t*)malloc(sizeof(Fila_t));
fila->inicio = fila->fim = NULL;
return fila;
}
/* função auxiliar: inserir no... |
C | #include <cstdlib>
#include "semantic.h"
#include "common.h"
#define SEM_ERROR(n, fmt, ...) { \
fprintf(errorFile, "SEMANTIC ERROR (line %d, column %d): " fmt "\n", n->line, n->column, ##__VA_ARGS__); \
errorOccurred = true; \
}
typedef struct {
std::vector<unsigned int> scope_id_stack;
} visit_data;
void sema... |
C | #include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h> // rand(), srand()
#include <time.h> // time()
#define NUM_OF_SBOXES 4
#define SIZE_OF_SBOX 16
#define NUM_OF_STAGES 4
#define BITS_OF_INPUT 16
#define NUM_OF_CYPHER_PAIRS 5000
struct nibbleList{
uint16_t currentLocation;
st... |
C | /**
* yaw.c - Yaw access and control for heli project
*
* Authors: Jos Craw, Josh Hulbert, Harry Dobbs
* Last Modified: 28.07.2020
*/
#include <stdint.h>
#include <stdbool.h>
#include <inc/hw_memmap.h>
#include <inc/hw_types.h>
#include <inc/hw_ints.h>
#include <driverlib/gpio.h>
#include <driverlib/sysctl.h>
#in... |
C | #include <stdio.h>
int main(void)
{
int num1, num2;
printf("Enter first number:");
scanf("%d", &num1);
printf("%d\n", num1 >= 76 && num1 <= 78);
printf("Enter second number:");
scanf("%d", &num2);
printf("%d", (num2 & 64) == 64);
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include <malloc.h>
char **divide_string(char *s){
int len,j=0,i;
char **subs;
*subs = (char *)malloc(sizeof(char *)*2);
if((len = strlen(s))%2 ==0){
subs[0] = (char *)malloc(len/2+1);
subs[1] = (char *)malloc(len/2+1);
for ( i = 0; i < len/2; i++) {
sub... |
C | #include "inc/key.h"
#include <stdlib.h>
Key* getKey(Key* self, int8_t keyNumber) {
uint8_t oct;
oct = MIN_OCTAVE;
// determine which octave we are in
while (keyNumber > KEYS_PER_OCT) {
keyNumber -= KEYS_PER_OCT;
oct++;
}
self->octave = oct;
self->letter = keyNumber;
return self;
}
... |
C | #include<stdio.h>
int main()
{
int a, b, sum;
a = 520;
b = 1314;
sum = a + b;
printf("sum=%d\n", sum);
return 0;
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_sprite.c :+: :+: :+: ... |
C | /**
* @author SANKALP SAXENA
*/
#include<stdio.h>
int main()
{
int t,x,y;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&x,&y);
x=x%4;
y=y%4;
if((x==0) || (x==3) || (y==0) || (y==3))
printf("First\n");
else
printf("Second\n");
}
return 0;
} |
C | #include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "myStringFxns.h"
/***************************************************************
* myGetline
* Description: reads a file for all characters before it finds
* a delimiter or the end of file. Then updates ... |
C | #include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char **get_inner_cmd(int *cmd_num) {
const int MAX_CMD_COUNT = 32;
const int MAX_CMD_LENGTH = 128;
char **commands = calloc(MAX_CMD_COUNT, sizeof(char *));
int cmd_cnt = 0;
DIR *dir = opendir("./commands");
if (dir ... |
C | /***************************************************************
Student Name: Mikayla Timm
File Name: BruteForce.c
Assignment number 3
Genetic
*BruteForce.c implements all the functions that deal with the brute force algorithm for
* solving the Traveling salesman problem.
*************************************... |
C | #include <assert.h>
#include <errno.h>
// #include <error.h>
#include <fcntl.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#define BUFSIZE 4096
#include "compute.h"
int main(int argc, char *argv[... |
C | #include "qdbmp.h"
#include <stdio.h>
int main()
{
BMP* bmp;
UCHAR r, g, b;
UINT width, height;
UINT x, y;
bmp = BMP_ReadFile("/home/ap4ep25/CLionProjects/untitled11/lena.bmp");
BMP_CHECK_ERROR( stderr, -1 ); /* If an error has occurred, notify and exit */
width = BMP_GetWidth(... |
C | int my_strcmp(const char *s1, const char *s2)
{
int iter = 0;
while ((s1[iter] == s2[iter]) && (s1[iter] != '\0') && (s2[iter] != '\0'))
iter++;
return (s1[iter] - s2[iter]);
}
|
C | /*
Copyright (C) 2015 Alin Mindroc
(mindroc dot alin at gmail dot com)
This is a sample program that shows how to use InstructionAPI in order to
6 print the assembly code and functions in a provided binary.
This program is free software; you can redistribute it and/or
modify it under the terms of the... |
C | #include <Python.h>
#include <structmember.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sys/stat.h>
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
void __swap( long flg, char* txt ) {
char s;
if( flg == 1 ) { s = txt[0]; txt[0] = txt... |
C | /*
connect.c
Mike Hufnagel & Bill Kendrick
Last modified 11/17/95 (changed to return NULL on error)
*/
#include <X11/Xlib.h>
#include "connect.h"
Display *ConnectToServer(char* display_name, int *screen, Window *rootwindow)
{
Display *display;
/* connect & check for problems */
display = XOpenDispla... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.